XML technologies / SVG / Using text elements / Solutions
(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)
To specify the character encoding, use the
encodingattribute in the SVG file’s first element.
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg>
...
</svg>
To insert text, again use the
<text>tag.
<text x="0" y="20">Texte können auch an Pfaden ausgerichtet werden!</text>Use the following instruction to create the path:
<path d="M0 0 l+300 +300"/>Name the path and align the text with it using the
<textPath>tag and its attributexlink:href:
<text x="0" y="20">
<textPath xlink:href="#linie">Texte können auch an Pfaden ausgerichtet werden!</textPath>
</text>
<path id="linie" d="M0 0 l+300 +300" />
For spaced text, add to the
<text>tag thestyleattribute as shown:<text x="0" y="20" style="letter-spacing:4">.
Copyright © verlag moderne industrie GmbH 2001
You may print the online version for your private use.
Otherwise, this chapter from “Das Einsteigerseminar SVG — Webgrafiken mit XML” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
verlag moderne industrie GmbH, Justus-von-Liebig-Straße 1, D-86899 Landsberg/Lech, fon ++49 (0) 81 91 / 125 – 0, leserservice(at)mi-verlag.de
back to top