Page MenuHomePhabricator

SVG text rendering problem
Closed, DuplicatePublicBUG REPORT

Description

SVG text rendering anomalies sometimes occur:

  1. if attributes are provided in group specifications <g___></g> or
  2. if <text> and <tspan> specifications are used together (<text> being like a grouping of <tspan>)

The anomalies seem to be solved by explicitly placing the attributes within '''''each specific''''' <text___></text> specification, to avoid depending on inheriting the attribute from the wider-scope <g>.

Examples:

Also:

Thanks for considering,
RCraig09

Event Timeline

Aklapper updated the task description. (Show Details)
Aklapper updated the task description. (Show Details)

Another incident of text being rendered properly in one en.WP article, but rendering wrongly in another en.WP article, is illustrated in the screenshot at https://commons.wikimedia.org/wiki/File:20230705_Inconsistent_simultaneous_displays_of_same_image_in_two_articles.png . . . (It involves switch and tspan elements for language translation.) --RCraig09 ~~~~

I assume that is because the cache is not purged

The correct rendering is in the Cache from librsvg2.40

The wrong rendering is newly rendered by librsvg2.44

I don't understand different versions of librsvg2.xx, but: I tried adding ?action=purge to https://en.wikipedia.org/wiki/Climate_change_denial, and I also tried Shift-Reload on Chrome for Mac. The problem remains. --RCraig09

Update, with apparent way to work around bug (does not solve apparent bug): removing <tspan> elements, and reciting attributes directly within <text> elements.

The image in question is https://commons.wikimedia.org/wiki/File:20211103_Academic_studies_of_scientific_consensus_-_global_warming,_climate_change_-_vertical_bar_chart_-_en.svg . . . Version 6 avoids the problem in Version 5.

A more complete discussion is at https://commons.wikimedia.org/wiki/File_talk:20230705_Inconsistent_simultaneous_displays_of_same_image_in_two_articles.png#Work-around

Further update (16 July): in the section
"SVG text rendering: probable bug"
at
https://commons.wikimedia.org/wiki/Talk:Librsvg_bugs#SVG_text_rendering:_probable_bug

User:Glrx says the problem isn't related to inheritance. He says the problem is:
"One failure mechanism is librsvg 2.44.10 does not calculate the width of an SVG "text chunk" correctly. Instead of the whole width, it is using the width of the last constituent."

This issue is a dup of T97233.

Gnome fixed it two years ago in C and Rust versions. It has reemerged because we are using a 4 or 5 year old Rust version now.

For more examples, see https://commons.wikimedia.org/wiki/File:SVG_Text_Chunk_Test.svg

Fixed in librsvg 2.50.2; see https://gitlab.gnome.org/GNOME/librsvg/-/issues/651