This is not something that SVG 1.1 supports. SVG 1.2 does have the
textArea element, with automatic word wrapping, but it's not implemented in all browsers. SVG 2 does not plan on implementing
textArea, but it does have auto-wrapped text.
However, given that you already know where your linebreaks should occur, you can break your text into multiple
<tspan>s, each with
dy="1.4em" to simulate actual lines of text. For example:
<g transform="translate(123 456)"><!-- replace with your target upper left corner coordinates --> <text x="0" y="0"> <tspan x="0" dy="1.2em">very long text</tspan> <tspan x="0" dy="1.2em">I would like to linebreak</tspan> </text> </g>
~ Answered on 2013-05-22 21:34:53