Closed
Bug 1323587
Opened 8 years ago
Closed 8 years ago
Some dwrite fonts are light or dark with skia
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
mozilla53
People
(Reporter: mchang, Assigned: mchang)
References
Details
(Whiteboard: gfx-noted)
Attachments
(2 files, 2 obsolete files)
(deleted),
patch
|
lsalzman
:
review+
lizzard
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
lsalzman
:
review+
lizzard
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Updated•8 years ago
|
Whiteboard: gfx
Assignee | ||
Comment 1•8 years ago
|
||
Some fonts were light or too dark depending on the font. We originally went solved this by forcing the default contrast / gamma of 0.5 / 1.8 respectively. However, skia fonts were still not quite right. Outside of gecko, after tracing through the LUT values, I could tell no difference. The problem was that for dwrite fonts with the recommended rendering mode, we should be using a contrast of 1.0, which is what d2d was doing.
However, originally, this caused other fonts to look odd or too bold. After lots of head banging, the fonts that force GDI backwards compatibility were the ones looking odd, and a contrast of 1.0 for these fonts was too dark compared to what d2d was rendering. I also verified this outside of gecko. These need a LUT of 2.3f gamma [1] with a contrast of 1.0. So even though we tell d2d to use a gamma of 1.8 and a contrast of 1.0f for GDI fonts, it looks roughly equal to that of a LUT of 2.3f and contrast 1.0.
This patch reaches out to gfxWindowsPlatform to get the contrast / gamma from the cleartype parameters we setup, and forces a 2.3f gamma LUT for forced GDI typefaces.
[1] http://searchfox.org/mozilla-central/source/gfx/skia/skia/src/ports/SkFontHost_win.cpp#1047
Attachment #8818712 -
Flags: review?(lsalzman)
Assignee | ||
Comment 2•8 years ago
|
||
Comment on attachment 8818712 [details] [diff] [review]
Set contrast to 1.0f for dwrite fonts and 2.3f gamma for GDI fonts
Review of attachment 8818712 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/skia/skia/src/ports/SkTypeface_win_dw.cpp
@@ +269,3 @@
> h = SkPaint::kSlight_Hinting;
> rec->setHinting(h);
>
I need to fix my non windows 10 indentation. I'll fix before push.
Assignee | ||
Updated•8 years ago
|
Whiteboard: gfx → gfx-noted
Comment 3•8 years ago
|
||
(In reply to Mason Chang [:mchang] from comment #1)
> Created attachment 8818712 [details] [diff] [review]
> Set contrast to 1.0f for dwrite fonts and 2.3f gamma for GDI fonts
>
> Some fonts were light or too dark depending on the font. We originally went
> solved this by forcing the default contrast / gamma of 0.5 / 1.8
> respectively. However, skia fonts were still not quite right. Outside of
> gecko, after tracing through the LUT values, I could tell no difference. The
> problem was that for dwrite fonts with the recommended rendering mode, we
> should be using a contrast of 1.0, which is what d2d was doing.
>
> However, originally, this caused other fonts to look odd or too bold. After
> lots of head banging, the fonts that force GDI backwards compatibility were
> the ones looking odd, and a contrast of 1.0 for these fonts was too dark
> compared to what d2d was rendering. I also verified this outside of gecko.
> These need a LUT of 2.3f gamma [1] with a contrast of 1.0. So even though we
> tell d2d to use a gamma of 1.8 and a contrast of 1.0f for GDI fonts, it
> looks roughly equal to that of a LUT of 2.3f and contrast 1.0.
>
> This patch reaches out to gfxWindowsPlatform to get the contrast / gamma
> from the cleartype parameters we setup, and forces a 2.3f gamma LUT for
> forced GDI typefaces.
>
> [1]
> http://searchfox.org/mozilla-central/source/gfx/skia/skia/src/ports/
> SkFontHost_win.cpp#1047
You need to add the line to set MOZILLA_INTERNAL_API to generate_mozbuild.py as well, not just moz.build
Also, you should add it under the section where it is already checking if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows'. Chucking 'windows' on to the gtk/android section like you did is not safe and will break.
Assignee | ||
Comment 4•8 years ago
|
||
Attachment #8818936 -
Flags: review?(lsalzman)
Assignee | ||
Updated•8 years ago
|
Attachment #8818712 -
Attachment is obsolete: true
Attachment #8818712 -
Flags: review?(lsalzman)
Assignee | ||
Comment 5•8 years ago
|
||
Attachment #8818936 -
Attachment is obsolete: true
Attachment #8818936 -
Flags: review?(lsalzman)
Attachment #8818943 -
Flags: review?(lsalzman)
Updated•8 years ago
|
Attachment #8818943 -
Flags: review?(lsalzman) → review+
Assignee | ||
Comment 6•8 years ago
|
||
Attachment #8819382 -
Flags: review?(lsalzman)
Assignee | ||
Comment 7•8 years ago
|
||
Updated•8 years ago
|
Attachment #8819382 -
Flags: review?(lsalzman) → review+
Pushed by mchang@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/def622794e83
Part 1: Use correct gamma and contrast for dwrite fonts. r=lsalzman
https://hg.mozilla.org/integration/mozilla-inbound/rev/6b11cbf213c4
Part 2: Reftest fuzzing for updated gamma and contrast. r=lsalzman
Assignee | ||
Comment 9•8 years ago
|
||
If these stick, can you please uplift to aurora Lee? Not sure you're on PTO next week though. Thanks!
Flags: needinfo?(lsalzman)
Comment 10•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/def622794e83
https://hg.mozilla.org/mozilla-central/rev/6b11cbf213c4
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox53:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Comment 11•8 years ago
|
||
Comment on attachment 8818943 [details] [diff] [review]
gamma.patch
Approval Request Comment
[Feature/Bug causing the regression]: bug 1314090, 52+, since we moved to Skia for content rendering
[User impact if declined]: Fonts on Windows can have incorrect gamma, thus looking too thin or too fat, depending on whether DirectWrite fonts are used.
[Is this code covered by automated tests?]: yes
[Has the fix been verified in Nightly?]: yes
[Needs manual test from QE? If yes, steps to reproduce]: no
[List of other uplifts needed for the feature/fix]: aurora
[Is the change risky?]: No
[Why is the change risky/not risky?]: Ensures fonts with Skia content on Windows look closer to what users had with Direct2D or Cairo content rendering.
[String changes made/needed]: None
Flags: needinfo?(lsalzman)
Attachment #8818943 -
Flags: approval-mozilla-aurora?
Comment 12•8 years ago
|
||
Comment on attachment 8819382 [details] [diff] [review]
reftest fuzzing for gamma change
Note that this patch is just fuzz necessitated by the real patch above. So this patch must be uplifted along with the other one.
Approval Request Comment
[Feature/Bug causing the regression]: bug 1314090, 52+, since we moved to Skia for content rendering
[User impact if declined]: Fonts on Windows can have incorrect gamma, thus looking too thin or too fat, depending on whether DirectWrite fonts are used.
[Is this code covered by automated tests?]: yes
[Has the fix been verified in Nightly?]: yes
[Needs manual test from QE? If yes, steps to reproduce]: no
[List of other uplifts needed for the feature/fix]: aurora
[Is the change risky?]: No
[Why is the change risky/not risky?]: Ensures fonts with Skia content on Windows look closer to what users had with Direct2D or Cairo content rendering.
[String changes made/needed]: None
Attachment #8819382 -
Flags: approval-mozilla-aurora?
Comment on attachment 8819382 [details] [diff] [review]
reftest fuzzing for gamma change
Tests for skia fix, let's try these on aurora.
Attachment #8819382 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment on attachment 8818943 [details] [diff] [review]
gamma.patch
Fix for font regression from 52, let's uplift this to aurora.
Attachment #8818943 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 15•8 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-aurora/rev/e4b8e4c0c669
https://hg.mozilla.org/releases/mozilla-aurora/rev/7abe1b00cb19
status-firefox52:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•