[Webkit-unassigned] [Bug 139322] Setting the "vector-effect" attribute in the SVG <text> tag to "non-scaling-stroke" has no effect

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 14 10:42:07 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=139322

--- Comment #8 from Nikolas Zimmermann <zimmermann at kde.org> ---
I have been working on a fix on this. While testing I found out another Chrome/Blink specific issue: 'text-rendering: geometricPrecision' breaks 'vector-effect: non-scaling-stroke' for text.

Since recently our text-rendering handling for geometricPrecision was aligned with Chrome/Blink we're plagued by the same issue, breaking 'vector-effect: non-scaling-stroke'.

Here's a breakdown of the problem/issue:

RenderSVGInlineText chooses a FontDescription with a size "close" to the final on-screen size (mapping the <text> object through all ancestor-defined transformations until either a composited ancestor or the root RenderView is reached).

When painting with such a "scaled font", one needs to scale e.g. the used stroke-width by the scale factor used to select the "scaled font". To implement support for non-scaling stroke, one can simply omit the scaling factor (that was missing so far in WebKit, and is implemented like this in Blink).

However when text-rendering: geometricPrecision is used, we do NOT select a "scaled font", but instead use the font-size as specified in the document, and rely on scaling the CTM prior to rendering with that font. Therefore the reported scalingFactor is 1 - omitting a scale factor of 1 or applying it has the same result - therefore non-scaling-stroke is broken, when implemented this way.

Trying the following in Chrome and Firefox:

<svg xmlns="http://www.w3.org/2000/svg">
  <g id="g" style="font: 16px sans-serif; text-rendering: geometricPrecision" transform="translate(0, 100) scale(2)">
    <text x="50" y="50" stroke="blue" stroke-width="3" vector-effect="non-scaling-stroke">hello there</text>
  </g>
</svg>

(line 2 from Saids test case)

--> works in Gecko, broken in Blink, and broken in WebKit (when implementing this as in Chromium/Blink).

The full fix needs to handle non-scaling-stroke for the two text-rendering modes: geometricPrecision vs. default text-rendering mode, support for various device scale factors, support for legacy engine and LBSE. PR will follow.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230614/1b07a75e/attachment.htm>


More information about the webkit-unassigned mailing list