Bug 59589 - REGRESSION(r77282-r77559): Scaled SVG text should pixel-align pre-scale
Summary: REGRESSION(r77282-r77559): Scaled SVG text should pixel-align pre-scale
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.6
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-04-27 02:15 PDT by Alan Tam
Modified: 2012-02-16 05:02 PST (History)
6 users (show)

See Also:


Attachments
test case (2.10 KB, application/xhtml+xml)
2011-04-27 02:15 PDT, Alan Tam
no flags Details
updated test case with mozilla and opera support (2.25 KB, application/xhtml+xml)
2011-04-27 22:19 PDT, Alan Tam
no flags Details
test results on Snow Leopard (301.78 KB, image/png)
2011-04-27 22:21 PDT, Alan Tam
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Tam 2011-04-27 02:15:23 PDT
Created attachment 91256 [details]
test case

See the attached test case.

<svg:g transform="scale(0.01)">
    <svg:text x="0" y="2000" style="font-size: 1100px; font-family: Georgia;">
        iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
    </svg:text>
 </svg:g>
 
The code above should draw "i" glyphs pixel aligned when they are 1100px large and then scaled down to 1/100 of its size.
WebKit r77559 later draw them pixel-aligned as if they are 11px large (i.e. after scaled down 1/100).
Comment 1 Dirk Schulze 2011-04-27 05:46:08 PDT
(In reply to comment #0)
> Created an attachment (id=91256) [details]
> test case
> 
> See the attached test case.
> 
> <svg:g transform="scale(0.01)">
>     <svg:text x="0" y="2000" style="font-size: 1100px; font-family: Georgia;">
>         iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
>     </svg:text>
>  </svg:g>
> 
> The code above should draw "i" glyphs pixel aligned when they are 1100px large and then scaled down to 1/100 of its size.
> WebKit r77559 later draw them pixel-aligned as if they are 11px large (i.e. after scaled down 1/100).

Scale is like zooming, this of course influences the kerning as well. If I understand you right, you want to have the distances between the letters independent of the scaling? Nevertheless, the current behavior is exactly how it should look like and is the same like in Opera and Firefox. I'd like to mark this bug as invalid.

Btw. The example doesn't differ between Safari 5 and WebKit trunk.
Comment 2 Dirk Schulze 2011-04-27 06:24:48 PDT
Can you please upload a new test and add -o-transform and -moz-transform so that we can compare the results with the behavior o other browsers? Maybe it's a bug in -webkit-transform, or the specification of scale is different between CSS and SVG.

Added some CSS transform experts to the bug. Maybe they can look at the example as well.
Comment 3 Alan Tam 2011-04-27 22:19:48 PDT
Created attachment 91428 [details]
updated test case with mozilla and opera support
Comment 4 Alan Tam 2011-04-27 22:21:20 PDT
Created attachment 91429 [details]
test results on Snow Leopard
Comment 5 Alan Tam 2011-04-27 22:45:03 PDT
Hi Dirk,

Please refer to the attached screenshot of my test results for the discussion below.

It is not a kerning issue, but whether to align every glyph of the font onto the pixel grid. Note from the test results (test case 3) that all 4 browsers except Firefox does attempt to align every glyph to the pixel grid. Hence, every "i" is rendered in the same color (colored due to subpixel-antialiasing). Personally I don't care which way the browsers renders.

For HTML with scaling (test case 2), I expect browsers, even if they align to pixel grid, aligns to the grid that is 100x larger (i.e. when the font is 1100px large). Hence, every "i" is rendered in different color. All browsers seem to agree with this.

Test results (test case 1) with all browsers except WebKit trunk are same as what I expected, which is the same as rendering HTML unscaled.

I don't care whether to revert to Safari 5's behavior or follow Firefox 4's, but I believe the current one in WebKit trunk is a bug. In fact no browser agree with current WebKit trunk's behavior.
Comment 6 Dean Jackson 2011-05-04 19:20:13 PDT
Alan, to clarify you're asking that the rendering revert to the previous behaviour, which is that the "i"s are different colours? And that would then match the HTML rendering (which has not changed)?

I don't think this has much to do with CSS transforms.
Comment 7 Alan Tam 2011-05-04 20:19:05 PDT
(In reply to comment #6)
> Alan, to clarify you're asking that the rendering revert to the previous behaviour, which is that the "i"s are different colours? And that would then match the HTML rendering (which has not changed)?

Yes, except "match the HTML rendering" should mean "match the HTML rendering of Firefox". Somehow Safari chooses to render all HTML text by aligning all glyphs to pixel grid (3rd row of 1st and 2nd columns in the screenshot). I don't know the reason (faster rendering?) but I believe it is irreverent to this discussion.


> I don't think this has much to do with CSS transforms.

Right, except for the caveat above. "Safari's HTML rendering" cannot be used to demonstrate expected behavior since it simply the unexpected behavior that I am complaining about. "Safari's HTML rendering with CSS transform" is what I want, so I simply used it to demonstrated what I expected to happen. You can safely ignore it given now we have the screenshot.
Comment 8 Simon Fraser (smfr) 2011-05-06 16:08:07 PDT
<rdar://problem/9357575>
Comment 9 Nikolas Zimmermann 2012-02-16 05:02:50 PST
Alan, I'm not 100% sure what you're actually asking for, can you re-explain?
I've compared WebKit trunk with Opera, and we render it exactly identical.