Steps to replicate the issue (include links if applicable):
- Render an SVG file that has newlines in the .textContent: <text xml:space="preserve">text with newline characters</text>
- For example, look at rendering of https://commons.wikimedia.org/wiki/File:SVG_Test_xml_space_preserve.svg
What happens?:
The newline characters cause a vertical displacement of the text. The text does not appear on the horizontal baseline but rather the two lines below the base line.
What should have happened instead?:
All the text should render on the baseline. Check by clicking the image and displaying in the browser.
The SVG 1.1 spec at https://www.w3.org/TR/SVG11/text.html#WhiteSpace states that under xml:space="preserve", all newlines are replaced by spaces: "convert all newline and tab characters into space characters."
Apparently, librsvg leaves them as newlines and interprets them as commands to start a new line.