You can make your text more structured by placing different text fragments into tspan elements and enclosing them with the text element, like this:
<text> <tspan>One piece of text</tspan> <tspan>Some other text</tspan> <tspan>More text</tspan> </text>
You can assign different attributes to a tspan element. In addition, you can assign common attributes to the text in the tspan elements by placing the attributes in the enclosing text element.
Let us modify our SVG Writer in such a way that it will take the first four words from the entered text and display each of them in a different tspan element, using a different set of attributes.
Since the drawText method will have to be changed significantly, it makes sense to build another ...