Chapter 3. Beyond Straight Lines
Baselines ensure that glyphs are positioned to create a pleasing line of text. However, we’ve already said that, in graphical layout, you don’t always want text to display in perfectly straight lines. Sometimes it’s fun to make text move out of those boring lines and into more complex curves—circles, spirals, around the edges of various objects, and so forth.
This chapter introduces the
<textPath> element, which allows you to use SVG path geometry to describe complex text layouts.
Creating Curved Text
We’ve shown (in Chapter 5 in SVG Text Layout) how you can position and rotate individual characters. For some simple designs, that’s enough. Example 3-1 spaces the letters of the word “Sunrise” in a semicircle, each letter positioned every 30° and rotated to match, as shown in Figure 3-1.
Example 3-1. Arranging letters around a shape with character position attributes
"0 0 400 230"
Text Positioned in a Curve
"Times New Roman"