Skip to content

[Skia] Text rendered as much less heavy compared to other browsers#59880

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
Scony:309152-skia-fix-text
Mar 5, 2026
Merged

[Skia] Text rendered as much less heavy compared to other browsers#59880
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
Scony:309152-skia-fix-text

Conversation

@Scony
Copy link
Contributor

@Scony Scony commented Mar 4, 2026

4613261

[Skia] Text rendered as much less heavy compared to other browsers
https://bugs.webkit.org/show_bug.cgi?id=309152

Reviewed by Carlos Garcia Campos.

This change makes all the text rendered by skia look right - i.e.
just like in other browsers - by incorrectly blending in linear color
space despite target being in non-linear color space.

Until this patch, the rendering was done mathematically correct i.e.
the blending was done with respect to target's color space. However,
historically, many fonts were designed for incorrect blending and hence
they look the most "correct" in such a circumstances.

As skia internally implements so called "gamma hack", this change
tweaks SkSurfaceProps to properly tune it so that text looks correct.
Despite chromium uses 0.2 for contrast and 1.2 for gamma, this change
chooses 0 for contrast and 1 for gamma, as the results are visually
indistinguishable and yet in some reftests, the differences between
anti-aliased pixels are smaller. So in other words, this change makes
text anti-aliasing more stable (uniform) when it comes to very small,
sub-pixel positioning differences.

No new tests.

Canonical link: https://commits.webkit.org/308692@main

86acd4d

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac 🧪 api-wpe
🧪 ios-wk2-wpt 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 🧪 unsafe-merge 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
🛠 watch-sim

@Scony Scony self-assigned this Mar 4, 2026
@Scony Scony added the WPE WebKit WebKit WPE component label Mar 4, 2026
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 4, 2026
@Scony Scony removed the merging-blocked Applied to prevent a change from being merged label Mar 4, 2026
@Scony Scony force-pushed the 309152-skia-fix-text branch from 7806518 to 9f3ddf9 Compare March 4, 2026 11:49
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 4, 2026
@Scony Scony removed the merging-blocked Applied to prevent a change from being merged label Mar 4, 2026
@Scony Scony force-pushed the 309152-skia-fix-text branch from 9f3ddf9 to e477d92 Compare March 4, 2026 12:56
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 4, 2026
@Scony Scony removed the merging-blocked Applied to prevent a change from being merged label Mar 4, 2026
@Scony Scony force-pushed the 309152-skia-fix-text branch from e477d92 to cad04eb Compare March 4, 2026 19:19
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 4, 2026
@Scony Scony removed the merging-blocked Applied to prevent a change from being merged label Mar 5, 2026
@Scony Scony force-pushed the 309152-skia-fix-text branch from cad04eb to 4ec95a3 Compare March 5, 2026 08:17
@Scony Scony marked this pull request as ready for review March 5, 2026 08:19
@alexgcastro alexgcastro added the GLib Suggested Backport - 2.52 Suggest this merge request be backported to the webkitglib/2.52 stable branch label Mar 5, 2026
@Scony Scony force-pushed the 309152-skia-fix-text branch from 4ec95a3 to 86acd4d Compare March 5, 2026 09:43
@Scony Scony added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Mar 5, 2026
https://bugs.webkit.org/show_bug.cgi?id=309152

Reviewed by Carlos Garcia Campos.

This change makes all the text rendered by skia look right - i.e.
just like in other browsers - by incorrectly blending in linear color
space despite target being in non-linear color space.

Until this patch, the rendering was done mathematically correct i.e.
the blending was done with respect to target's color space. However,
historically, many fonts were designed for incorrect blending and hence
they look the most "correct" in such a circumstances.

As skia internally implements so called "gamma hack", this change
tweaks SkSurfaceProps to properly tune it so that text looks correct.
Despite chromium uses 0.2 for contrast and 1.2 for gamma, this change
chooses 0 for contrast and 1 for gamma, as the results are visually
indistinguishable and yet in some reftests, the differences between
anti-aliased pixels are smaller. So in other words, this change makes
text anti-aliasing more stable (uniform) when it comes to very small,
sub-pixel positioning differences.

No new tests.

Canonical link: https://commits.webkit.org/308692@main
@webkit-commit-queue
Copy link
Collaborator

Committed 308692@main (4613261): https://commits.webkit.org/308692@main

Reviewed commits have been landed. Closing PR #59880 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 4613261 into WebKit:main Mar 5, 2026
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Mar 5, 2026
@carlosgcampos carlosgcampos removed the GLib Suggested Backport - 2.52 Suggest this merge request be backported to the webkitglib/2.52 stable branch label Mar 5, 2026
@carlosgcampos
Copy link
Contributor

Backported to 2.52 branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WPE WebKit WebKit WPE component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants