SK_GAMMA_EXPONENT usage

111 views
Skip to first unread message

Stewart Connor

unread,
Jun 11, 2020, 1:46:27 AM6/11/20
to skia-discuss
Hey guy,

I'm trying to match the text rendering of Chromium in Skia. Our's come out looking slightly less bold and with what looks like different anti-aliasing. Fidelity in our system is of high priority so we're trying to match it as much as reasonably possible. For context the first picture is from chromium and the second is from our skia based renderer. It's going to be hard to notice the difference without fullscreen image comparing them though (also ignore the leading difference).




I've noticed that the build which Chromium uses (under their build.gn) adjusts the `SK_GAMMA_EXPONENT` and `SK_GAMMA_CONTRAST` values. I assumed that's what would be causing these differences for us, however upon adjusting it to the same values that Chromium builds with, I still get the exact same output from our renderer. I assume I may have my build for it set up wrong. 

Would someone be able to clarify what these values visually affect?

Thanks!

Stewart Connor

unread,
Jun 11, 2020, 1:52:55 AM6/11/20
to skia-discuss
Not sure why images aren't working. I've uploaded them externally to https://imgur.com/a/AK482tY with the first image being from chromium and the second being from our renderer. 
There's a very subtle difference between them. It's a more prevalent on thinner fonts such as https://imgur.com/a/VTR9TMb (first being chromium and second being our renderer).

Ben Wagner

unread,
Jun 11, 2020, 10:22:00 AM6/11/20
to skia-d...@googlegroups.com
There are so many variables here, it's hard to say. Which platform or backend is actually drawing the fonts (each one draws sometimes dramatically differently)? Blink sometimes draws a font with the system specific backed (like out of SkFontMgr_mac_ct or SkFontMgr_win_dw) and sometimes out of the FreeType one (SkFontMgr_custom_empty, backed by FreeType). If you're drawing with FreeType note that Chrome builds its own very close to tip of tree FreeType so there may be rendering differences just from that. Also, depending on how things are configured between software and gpu bakends you may get differences especially at middle sizes due to the use of signed distance fields on the GPU or just differences in path rendering. Also, I'm not sure how Chrome renders in your situation what the color space on the SkSurface might be, which can also affect things. Also the settings on SkFont may also make a difference (like hinting, baseline snapping, subpixel positioning, etc) and it isn't always easy to tell which settings are being used for these by Blink without actually debugging it.


Empowering the world to design
Share accurate information on COVID-19 and spread messages of support to your community.
   

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/bf427eed-dcac-4443-b62c-92976dd27759n%40googlegroups.com.

Stewart Connor

unread,
Jun 12, 2020, 3:00:39 AM6/12/20
to skia-discuss
Thanks for your help bungeman.

They're both running on linux with the freetype backend. We're using a system library of freetype, so I'll take a look into trying to build it out ourselves and see if that makes a difference. The version of Chromium we're running is on GPU with our's being on CPU, however I've tried to compare it with Chromium running on the software renderer and it still produces quite a different boldness appearance result. I'm not ruling it out entirely though. We're also using SkParagraph, so I'll take a look into the differences there may be on the SkFont settings. 

Out of curiosity do you know what affect `SK_GAMMA_EXPONENT` and `SK_GAMMA_CONTRAST` have on text visually? Only reason I bring it up is because of this bug report from years ago https://bugs.chromium.org/p/chromium/issues/detail?id=146407 which has visual differences that seems somewhat similar to ours.

Thanks again.

Ben Wagner

unread,
Jun 12, 2020, 9:00:21 AM6/12/20
to skia-d...@googlegroups.com
On Fri, Jun 12, 2020 at 3:00 AM 'Stewart Connor' via skia-discuss <skia-d...@googlegroups.com> wrote:
Thanks for your help bungeman.

They're both running on linux with the freetype backend. We're using a system library of freetype, so I'll take a look into trying to build it out ourselves and see if that makes a difference. The version of Chromium we're running is on GPU with our's being on CPU, however I've tried to compare it with Chromium running on the software renderer and it still produces quite a different boldness appearance result. I'm not ruling it out entirely though. We're also using SkParagraph, so I'll take a look into the differences there may be on the SkFont settings. 

Out of curiosity do you know what affect `SK_GAMMA_EXPONENT` and `SK_GAMMA_CONTRAST` have on text visually? Only reason I bring it up is because of this bug report from years ago https://bugs.chromium.org/p/chromium/issues/detail?id=146407 which has visual differences that seems somewhat similar to ours.


Probably the best current explanation (other than what the code actually does) for what these do can be seen at https://bugs.chromium.org/p/skia/issues/detail?id=1187 .  Note that there is also SK_GAMMA_APPLY_TO_A8 which controls if that applies to A8 glyphs. It looks like Chrome only applies that on Android. The issue with A8 is that the pixels are just too big.
 
Reply all
Reply to author
Forward
0 new messages