New issue
Advanced search Search tips

Issue 733389 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

run_layout_test canvas font rendering has broken hinting/spacing

Project Member Reported by fs...@chromium.org, Jun 14 2017

Issue description

While trying to create a test to check the fix for  crbug.com/730661 , I created the tests attached to this bug.

Both html renders identically on Chrome or Content Shell (see attached img1.png).

When I run on layout tests, the expected runs as img1.png, but the actual test renders as img2.png.

Help?
 
canvas-font-min-render.html
231 bytes View Download
canvas-font-min-render-expected.html
214 bytes View Download
img1.png
5.4 KB View Download
img2.png
5.3 KB View Download

Comment 1 by fs...@chromium.org, Jun 14 2017

Cc: junov@chromium.org foolip@chromium.org

Comment 2 by fs...@chromium.org, Jun 14 2017

Cc: ojan@chromium.org senorblanco@chromium.org e...@chromium.org

Comment 3 by foolip@chromium.org, Jun 14 2017

Cc: ksakamoto@chromium.org kojii@chromium.org
kojii@ or ksakamoto@ might have run across something like this when working with fonts.

Comment 4 by kojii@chromium.org, Jun 15 2017

Which platform is it failing?

As a general rule, text is not as linear as graphics is; i.e., 1px font scaled by 100 does not guarantee to match to 100px font. This is for better readability. Even within Blink, it may vary by versions or by fonts.

Can we test without relying on it?

Comment 5 by ojan@chromium.org, Jun 15 2017

Cc: -ojan@chromium.org

Comment 6 by fs...@chromium.org, Jun 15 2017

This was on Linux. 

I know that text is not linear, but on my compiled browser, those two methods render identical results. Only on run_layout_tests I get this weird kerning/hinting, and the fonts are the correct size. So I don't think it's a size problem.

The bug is that there's something that run_layout_tests triggers that make content_shell - on this example - draw the font with the correct size, but with the spacing be completely off.


Comment 7 by kojii@chromium.org, Jun 15 2017

Spacing is also not linear, small fonts tend to have more tracking than large fonts (ratio-wise), so the result looks normal to me, and I'm more surprised it works on your local machine.

But you seem to be aware of these. If the question is to infra to know the diff between normal Ubuntu and try bots, I don't know the answer, sorry. Such font difference isn't rare for me, I used to try to fix tests in such cases. I'm also curious what infra is using. Sorry again that I don't seem to be a help.

Comment 8 by fs...@chromium.org, Jun 28 2017

I understand this. But my issue is: we are having different behavior on spacing between run_layout_tests and chrome/content_shell. I'd like to know where this is coming from. 

Comment 9 by kojii@chromium.org, Jun 28 2017

Cc: drott@chromium.org
> different behavior on spacing between run_layout_tests and chrome/content_shell

Oh, I misunderstood, sorry. I see. On the same machine, or bot?

+cc drott@, our linux font experts, but from symptom, it sounds like test runner setting up different font for serif to me. How test runner sets up environment is a great unknown and we hit mysterious behavior several times too, I'm not sure if anyone knew the answer.

Sorry, not helping much.

Comment 10 by fs...@chromium.org, Jun 28 2017

That's on the same machine.

Comment 11 by drott@chromium.org, Jun 28 2017

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/fonts/linux/FontRenderStyle.cpp?l=101

Also see FontPlatformDataLinux SetupPaint(). IsRunningLayoutTest() usually disables subpixel positioning to reduce layout test font differences, with the exception of fast/text/sub-pixel/. 

Recently, I refurbished this on Windows so that if antialiasing is disabled, subpixel positioning is, too, compare:
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/fonts/win/FontPlatformDataWin.cpp?q=FontPlatformData&sq=package:chromium&dr=CSs&l=64

If you're comparing Canvas to non Canvas rendering, there might be differences in how the SkPaint is set up.
Project Member

Comment 12 by sheriffbot@chromium.org, Jun 29 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Owner: fs...@chromium.org
Status: Assigned (was: Untriaged)
fserb@, if you disable various bits that depend on IsRunningLayoutTest() as suggested by drott@, do you still observe the behavior? Assigning back to you to determine if it is such a deliberate difference when running layout tests or not. If it is, possibly it's still not the best setup, of course.
Owner: foolip@chromium.org
I disabled everything I could find on platform/font related to IsRunningLayoutTest() and I still get the same broken behavior.

Even thought the subpixel position may be to blame, I don't think is the IsRunningLayoutTest, because both expected and non-expected run with this flag on.

How about if you simply load this test manually in content_shell? I guess that looks different from when doing the same in a chrome binary built from the same tree?
With content_shell they both look correct.
So it looks correct in content_shell manually, but not when content_shell is running layout tests? Even if it isn't because of IsRunningLayoutTest, it does seem like it's because of different settings when running tests.

drott@, do you know of other font-related differences that don't boil down to IsRunningLayoutTest?
Cc: -junov@chromium.org

Sign in to add a comment