XML technologies / SVG / Using text elements / Summary, questions and exercises

(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)

Summary

  • Text can be defined with the <text> tag.

  • The tag <tref> allows named <text> tags to be reused at several positions.

  • The tag <tspan> lets you format parts of text separately.

  • Text is always aligned to its anchor and baseline. Both can be moved.

  • Position text with the attributes x and y.

  • To align text to a path, use the <textPath> element.

Questions and exercises

The following exercises form a single unit.

  1. Create an SVG file and specify the German character encoding to use.

  2. Insert the text “Texte können an Pfaden ausgerichtet werden!” (“Text can be aligned to paths!”).

  3. In the file, create a line with the <path> tag, running from the upper left to the lower right. Leave it unformatted so it remains invisible.

  4. Name the path and align the text to it.

  5. Set the character spacing so the text appears widely spaced.

   

 

 

 

back to top