librsvg bugs

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Wikimedia Commons currently uses abandonware c-librsvg 2.40.x[1] for rendering images, which is deprecated since 2017[2][3][4]. It's a fast renderer compared to Inkscape or batik, but it can be buggy at times. To make matters worse, the upstream has rewritten a lot of the tool in Rust since 2.41, fixing many bugs but making it very hard for WMF engineers to upgrade on the Debian stretch system we have. The language change also makes it near-impossible to transplant (backport) the fixes. However there is a discussion about re-evaluating the svg-renderer on phab:T40010, and according to SVG Benchmark, it seems that rendersvg (also written in Rust) is much faster and has a much better SVG-support than librsvg, Inkscape has also a good SVG-support but is slower than librsvg.

Some files may be fixed now. If there are any files that were uploaded earlier and have an error in displaying, you can try Purging the file to force a re-render. You should check all the resolutions, since the bugs can show up differently in different resolutions.

If you see a buggy image, tag it with {{Rsvg bug}}. This puts it in Category:Pictures showing a librsvg bug. Some more bugs are reported at Commons:Commons SVG Checker#Checks.

librsvg-history on Wikimedia
version live on Wikimedia
number date[5] begin end
2.3.93[6] 2006[7]
2.14.0[7] 2006[7] at least 2007[8]
2.40.16[9] 2016-06 2016[9] 2017[10]
2.40.18[10] 2017-07 2017[10] 2019[11]
2.40.20-3[12][1] 2017-12 2019[11] 2020[13]
2.40.21[14] 2020-02 2020[13] current
2.42.0 2018-01
2.44.0 2018-08
2.46.0 2019-09
2.48.0 2020-03
2.50.0 2020-09
2.52.0 2021-09

Rendering of text[edit]

CSS inheritance[edit]


Hairline cracks[edit]

phab:T20936: This bug appears also in modern browsers on zooming levels.

White gap visible at odd px sizes (299px)
Same pic 1px larger rendered (300px)

An workaround can be the using of merge path.


phab:T32033: The File:EKG-Reto 001.svg shows a pattern with stroke-dasharray wrongly as full lines (a bit lesser the bigger the thumb size).


phab:T20463: The libRSVG's handling of SVG pattern is only rudimentary. Some fixed examples (bug in file history):

Clip path[edit]


The presentation of markers is in different viewers implemented differently. The origin point varies. Inkscape shows the boundaries incorrectly.

Code of 3) use the translate attribute.

<circle id="circle3" transform="translate(20, 20)" stroke="rgb(0%, 70%, 0%)" cx="0" cy="0" r="20"/>
<marker id="marker3" refX="20" refY="20" viewBox="0 0 40 40"
    markerUnits="userSpaceOnUse" markerWidth="40" markerHeight="40">
  <use xlink:href="#circle3"/>  
<line x1="130" x2="270" y1="180" y2="180" marker-start="url(#marker3)" marker-end="url(#marker3)"/>

Note that orient="auto-start-reverse" is not implemented in SVG 1.1.

Embedded bitmaps[edit]

The first uploads of File:Solar_system_bodies_rotation_animation.svg and File:Cambridge_Kings_Ditch_map.svg gave blank thumbnails as width and height parameters of the image tag were omitted, though they rendered fine on Firefox and Chrome.

Nested use tags[edit]

Two lines of text should appear in the thumbnail but only one does

Since autumn 2020, a use element referencing another use element does not render, see phab:T276684. A work around is to wrap the inner one with a g – for example, replace

<use id="outer" xlink:href="#inner"/>
<use xlink:href="#outer"/>


<g id="outer">
    <use xlink:href="#inner"/>
<use xlink:href="#outer"/>

List of open Phab SVG bugs[edit]

Incomplete (please add missing ones e.g. from

Can be solved using[edit]

  • phab:T32033 stroke-dasharray in PNG thumbnails does not support spaces as separators
  • phab:T35245 Multiple x-coordinates in text/tspan
  • phab:T43424 flowRoot (defined only in deprecated SVG 1.2 draft) not supported by rsvg
  • phab:T55899 SVG masks fail to render (or even display)
  • phab:T68672 SVG style element ignored if no type="text/css" attribute is specified
  • phab:T184369 font-family="'font name'" and style="font-family:'font name'" does not work in SVG rendering
  • phab:T194192 viewBox="0,0,620,472" should be the same as viewBox="0 0 620 472"
  • phab:T217990 arc flags without space not regognized

No automatic solution available[edit]

  • phab:T36947 Bad kerning (workaround: try using larger font-size then transform to scale it down)
  • phab:T193352 Update librsvg to ≥2.42.3 (fixes kerning)

Solution not yet determined[edit]

  • phab:T261192 Rendering multilingual (systemLanguage) SVG files fails after upgrading librsvg from 2.40.21 to 2.44.10 possibly due to the LANG environment variable not controlling the language preference