Skip to content

Instantly share code, notes, and snippets.

@ryuukk
Last active June 6, 2022 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryuukk/5fcbafabafd85fda1a8d94e31bdbf754 to your computer and use it in GitHub Desktop.
Save ryuukk/5fcbafabafd85fda1a8d94e31bdbf754 to your computer and use it in GitHub Desktop.
Fix chrome's font rendering gamma issue with a single patch!
diff --git a/skia/BUILD.gn b/skia/BUILD.gn
index 5c3a90ee..e59abc5 100644
--- a/skia/BUILD.gn
+++ b/skia/BUILD.gn
@@ -150,7 +150,7 @@
}
# Settings for text blitting, chosen to approximate the system browser.
- if (is_linux || is_chromeos) {
+ if (is_chromeos) {
defines += [
"SK_GAMMA_EXPONENT=1.2",
"SK_GAMMA_CONTRAST=0.2",
@@ -161,6 +161,12 @@
"SK_GAMMA_EXPONENT=1.4",
"SK_GAMMA_CONTRAST=0.0",
]
+ } else if (is_linux) {
+ defines += [
+ "SK_GAMMA_APPLY_TO_A8",
+ "SK_GAMMA_EXPONENT=1.8",
+ "SK_GAMMA_CONTRAST=0.8",
+ ]
} else if (is_win) {
defines += [
"SK_GAMMA_SRGB",

Results

YouTube Dark Theme

  • Linux (Stock) linux_yt_stock_dark

  • Windows (Stock) windows_yt_dark

  • Linux (Patch) linux_yt_pr_dark

YouTube Light Theme

  • Linux (Stock) linux_yt_stock_light

  • Windows (Stock) windows_yt_light

  • Linux (Patch) linux_yt_pr_light

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