Page MenuHomePhabricator

SVG Check renders text (font: Liberation Sans) differently
Closed, DuplicatePublic

Description

The rendering of

<?xml version="1.0" encoding="UTF-8"?>
<svg width="376" height="212" viewBox="0 0 1200 675" xmlns="http://www.w3.org/2000/svg" text-anchor="middle" font-family="Liberation Sans">
 <text x="800" y="253" font-size="40">portion of attempts that are <tspan font-style="italic">lethal</tspan>:</text>
</svg>

in https://svgcheck.toolforge.org/index.php is different to https://upload.wikimedia.org/wikipedia/commons/thumb/archive/b/bd/20230426142411%21Test.svg/376px-Test.svg.png

Commons(Liberation 2)

Test.svg.png (212×376 px, 29 KB)

SVG-check(Liberation 1)

20230425044303200012_suicide_methods_in_order_of_lethality__variablewidth_bar_chartpusocs_btscss.png (212×376 px, 26 KB)

OriginalSVG

difference
not only the alignment as reported in Wikipedia is different, also the Liberation Sans font looks different.

Liberation 1 vs Liberation 2
Checking T253600 it seems they use different version of fonts: SVG-check maybe Liberation 1 but Commons uses Liberation 2

Liberation 1Liberation 2SVG-checkCommons
wmf270px-Sea_level_history_and_projections.svg.png (203×270 px, 14 KB)
lib2270px-Sea_level_history_and_projections.svg.png (203×270 px, 15 KB)
sea_level_history_and_projections.png (203×270 px, 16 KB)
Sea_level_history_and_projections.svg.png (203×270 px, 15 KB)

Copyleft

  • AlignmentSVG

source: https://commons.wikimedia.org/wiki/File:200012_Suicide_methods_in_order_of_lethality_-_variable-width_bar_chart.svg

author: https://commons.wikimedia.org/wiki/User:RCraig09

license: https://creativecommons.org/licenses/by-sa/4.0/

  • LiberationSVG

source: https://commons.wikimedia.org/wiki/File:Sea_level_history_and_projections.svg

author: https://commons.wikimedia.org/wiki/User_talk:Efbrazil

license: https://creativecommons.org/licenses/by-sa/4.0/

Event Timeline

This looks like the text-chunk regression bug.

librsvg erroneously calculates the width of the whole text chunk as the width of the last tspan or #text node. In this case, the last #text node is ":", so librsvg believes the whole string should be offset from the anchor by half the width of a colon. That makes the text appear to start at the anchor; it looks left aligned rather than middle aligned.

So bug is a duplicate of T200443.

Close a duplicate failed. trying again.