Page MenuHomePhabricator

librsvg mishandles newlines when xml:space=preserve
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

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.

Event Timeline

Glrx renamed this task from librsvg mishandles newlines xml:space=preserve to librsvg mishandles newlines when xml:space=preserve.Aug 24 2022, 9:48 PM

T40010 reevaluate renderer...

https://gitlab.gnome.org/GNOME/librsvg/-/issues/45 Gnome issue 45 ("[BZ#636660] xml:space="preserve" is not processed correctly") has been fixed, so upgrading to a later version of librsvg should fix this problem. "These fixes first appeared in librsvg 2.41.2; they are in the 2.42.x stable series right now." T261192

TheDJ claimed this task.
TheDJ subscribed.

Verified fixed