Skip to Content
Special Edition Using XML, Second Edition
book

Special Edition Using XML, Second Edition

by - et al. David Gulbransen
July 2002
Intermediate to advanced
864 pages
22h 32m
English
Que
Content preview from Special Edition Using XML, Second Edition

Text Handling in SVG

Text handling in SVG is carried out with three elements— <text>, which is always used when laying out text, and, optionally, <tspan> and <tref> elements.

The <text> Element

To lay out text, the SVG rendering engine needs to know, in addition to what characters to render, where to place the text, what font and font size to use, and so on. You saw in Listing 23.1, the rollover button example, how text is used with a rollover button.

It is important to notice the difference in how the x and y attributes of <rect> and <text> elements are used. Listing 23.21 illustrates the difference in usage.

Listing 23.21. The Difference in Usage of x and y Attributes in <text> and <rect> Elements (DiffTextRect.svg)
 <?xml version="1.0" standalone="no"?> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

XML Pocket Reference, 3rd Edition

XML Pocket Reference, 3rd Edition

Simon St. Laurent, Michael Fitzgerald
Essential XML: Beyond Markup

Essential XML: Beyond Markup

Don Box, Aaron Skonnard, John Lam

Publisher Resources

ISBN: 078972748XPurchase book