GNOME Bugzilla – Bug 749415
[Wikimedia] Incorrect text positioning after path element with scaling.
Last modified: 2016-01-06 20:37:18 UTC
Downstream: https://phabricator.wikimedia.org/T65703 After a path element containing a transform with strong down scaling (x0.2) any text element has incorrect text positioning. This is equal as having a very small font size where kerning is applied and afterward it is upscaled. Example: https://commons.wikimedia.org/wiki/File:Ikaros_solar_sail_key_plain.svg https://upload.wikimedia.org/wikipedia/commons/c/c7/Ikaros_solar_sail_key_plain.svg
Created attachment 303415 [details] [review] This patch fixes Gnome Bugzilla bug #749415 where text is positioned incorrect if before any path element containing a transform with strong downscaling was applied.
My patch has unwanted sideeffects. Don't commit it.
Created attachment 303852 [details] [review] This patch fixes Gnome Bugzilla bug #749415 where text is positioned incorrect if before any path element containing a transform with strong downscaling was applied. I've reworked my patch with slight modifications. Now it renders all icons from Tango Desktop Project similar to librsvg-2.40.9 without any visible differences according to perceptualdiff included in librsvg test directory. This patch fixes Gnome Bugzilla bug #749415 where text is positioned incorrect if before any path element containing a transform with strong downscaling was applied. In librsvg hierachical structures introduced by the XML tree are applied by some kind of stack to save informations of a certain level. In the function for rendering path elements the stack is only pushed under certain conditions. It is not easy to figure out why the stack is only used under these conditions. Here it is assumed it is not always done to improve performance since it is not always necessary to use that stack. This patch removes any conditions and always uses this stack for path elements.
*** Bug 756071 has been marked as a duplicate of this bug. ***
Created attachment 318150 [details] [review] Fixes bug #749415 where text is positioned incorrect if before any path element containing a transform with strong downscaling was applied.
The last patch also contains a binary png. Bugzilla doesn't show it during review.
Pushed as cb7fd6b635a519e968ea67ec529651fe774abe26 to master; this should be in 2.40.13. Thanks for looking into this bug. It turns out that the logic to decide whether to create an intermediate surface *is* already in rsvg_cairo_push/pop_discrete_layer(), and it didn't need to be (badly) duplicated in rsvg_cairo_render_path(). Those functions bail out early without creating a temporary surface if it is not needed (e.g. if there is no filter or mask).