iBet uBet web content aggregator. Adding the entire web to your favor.
iBet uBet web content aggregator. Adding the entire web to your favor.



Link to original content: https://phabricator.wikimedia.org/T370044
⚓ T370044 PNG thumbnail of SVG file: Text not centered and cut off
Page MenuHomePhabricator

PNG thumbnail of SVG file: Text not centered and cut off
Open, Stalled, LowPublicBUG REPORT

Description

see: https://commons.wikimedia.org/wiki/File:Dummydenkmal.svg & https://upload.wikimedia.org/wikipedia/commons/a/a0/Dummydenkmal.svg

While the text in the original svg is centered, the text in the rendered png is not.

this worked until recently but now it seems to be broken.

Event Timeline

Aklapper renamed this task from rendering of svg to png somehow broken to PNG thumbnail of SVG file: Text not centered and cut off.Jul 15 2024, 1:04 PM
Aklapper edited projects, added Thumbor; removed Wikimedia-SVG-rendering.

Specifying one single font with zero fallbacks, and crossing fingers that it will be also available server-side, is extremely likely to fail.
I'd rather ask the SVG author to fix their SVG and I am very tempted to close this ticket as declined.

style="font-size:53.66563034px;font-style:oblique;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:120.00000477%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#808080;fill-opacity:1;stroke:#808080;stroke-width:1.11803401;stroke-opacity:1;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold Oblique">

acc. to @JoKalliauer there seems to be a render problem with
transform="scale( in combination with <text and text-anchor="middle").

I have now replaced the problematic files with smaller and (at the moment) working versions,
thus for me the problem is solved by workaround. If you are interested in fixing the original underlying problem, please feel free (I'm not able to provide an minimal non-working example).

Could someone please check if this problem persists in more recent librsvg versions? Thanks.

https://gitlab.gnome.org/GNOME/librsvg/-/issues/967
[regression] scale with text-anchor="end" leads to offset

cites

Looking at that file, overlap (right 1/3 of image) shows a mismatch at bottom left for the small scaled text but not for the large scaled text.

<use xlink:href="#base" transform="translate( 27,201)scale(0.93,1)"/>
<use xlink:href="#base" transform="translate( 27,251)scale(2.37)"/>

So it looks like scale(0.93, 1) fails but scale(2.37) succeeds. Did a matrix multiply go wrong?

Gnome report suggests error still present in v2.56.0.

Yes, it affects only non-uniform text scaling. Glrx wrote in https://commons.wikimedia.org/w/index.php?title=Commons:Graphics_village_pump&diff=prev&oldid=905407387

RSVG is asked to center the text. It calculates the width of the text without scaling. Say that is 400 pixels. It then takes 1/2 that value to compute the starting point; the starting point is then 200 pixels left of the anchor point. Then it paints the text, but the scaling is applied while painting. If the scale factor is 0.9, then the text will be 360 pixels wide. The text will appear shifted to the left by 20 pixels. (If the scaling is 1.1, then the text would appear shifted to the right.)

Could someone please check if this problem persists in more recent librsvg versions? Thanks.

Simple cases, such as

are fixed in librsvg 2.57.1 (or earlier)

However in combination with pattern or groups <g transform="scale( as in https://en.wikipedia.org/wiki/File:Cake_number_3.svg is reported upstream: https://gitlab.gnome.org/GNOME/librsvg/-/issues/1109

I think someone should be bold and update&extend this task-description f.e. extend it with other examples or what problematic Code is rendered wrong. I think a good/improved task-description is in the interest of everyone.

This comment was removed by Taylor.
JoKalliauer changed the task status from Open to Stalled.Fri, Dec 6, 4:46 PM
JoKalliauer triaged this task as Low priority.
JoKalliauer moved this task from Backlog to Upstream (librsvg) on the Thumbor board.