Bug 206573 - [WinCairo] -webkit-font-smoothing:antialiased makes fonts blurry
Summary: [WinCairo] -webkit-font-smoothing:antialiased makes fonts blurry
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-01-22 00:25 PST by Fujii Hironori
Modified: 2020-06-24 12:58 PDT (History)
4 users (show)

See Also:


Attachments
[Screenshot] Google News (Japan) of WinCairo port (150% display scale factor) (209.77 KB, image/png)
2020-01-22 00:26 PST, Fujii Hironori
no flags Details
test case (1.66 KB, text/html)
2020-01-22 01:32 PST, Fujii Hironori
no flags Details
[screenshot] GMail in WinCairo (with -webkit-font-smoothing support, r254899) (191.42 KB, image/png)
2020-01-22 18:25 PST, Fujii Hironori
no flags Details
[screenshot] GMail in WinCairo (without -webkit-font-smoothing support, r254326) (189.81 KB, image/png)
2020-01-22 18:26 PST, Fujii Hironori
no flags Details
[screenshot] https://www.apple.com/ in WinCairo (with -webkit-font-smoothing support, r254899) (371.88 KB, image/png)
2020-06-24 00:40 PDT, Fujii Hironori
no flags Details
Patch (2.44 KB, patch)
2020-06-24 01:31 PDT, Fujii Hironori
achristensen: review+
Details | Formatted Diff | Diff
[screenshot] https://www.apple.com/ in WinCairo with the proposed patch (314.87 KB, image/png)
2020-06-24 01:32 PDT, Fujii Hironori
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2020-01-22 00:25:44 PST
[WinCairo] small MS Gothic font with -webkit-font-smoothing:antialiased is blurry

r254506 (Bug 54763) added -webkit-font-smoothing support. Since then some texts in Google News of Japanese are rendered blurry.

1. Start WinCairo MiniBrowser
2. Go to https://news.google.com/?hl=ja&gl=JP&ceid=JP%3Aja
Comment 1 Fujii Hironori 2020-01-22 00:26:21 PST
Created attachment 388403 [details]
[Screenshot] Google News (Japan) of WinCairo port (150% display scale factor)
Comment 2 Fujii Hironori 2020-01-22 01:32:54 PST
Created attachment 388406 [details]
test case
Comment 3 Fujii Hironori 2020-01-22 18:25:45 PST
Created attachment 388502 [details]
[screenshot] GMail in WinCairo (with -webkit-font-smoothing support, r254899)

I realized GMail also looks blurry even for alphabet.
Comment 4 Fujii Hironori 2020-01-22 18:26:43 PST
Created attachment 388504 [details]
[screenshot] GMail in WinCairo (without -webkit-font-smoothing support, r254326)

Old WinCairo renders clearly.
Comment 5 Fujii Hironori 2020-01-22 18:32:15 PST
I'm spoofing Safari User-Agent string to use GMail in WinCairo.
Comment 6 Fujii Hironori 2020-06-24 00:40:43 PDT
Created attachment 402626 [details]
[screenshot] https://www.apple.com/ in WinCairo (with -webkit-font-smoothing support, r254899)
Comment 7 Fujii Hironori 2020-06-24 01:08:20 PDT
-webkit-font-smoothing:antialiased is mapped to CAIRO_ANTIALIAS_GRAY.
And CAIRO_ANTIALIAS_GRAY is mapped to ANTIALIASED_QUALITY.

If I changed to use DEFAULT_QUALITY instead of
ANTIALIASED_QUALITY by applying the following patch to Cairo, the
font looked good.

diff --git a/src/win32/cairo-win32-font.c b/src/win32/cairo-win32-font.c
index 1f217573b..355192dc0 100644
--- a/src/win32/cairo-win32-font.c
+++ b/src/win32/cairo-win32-font.c
@@ -347,7 +347,7 @@ _win32_scaled_font_create (LOGFONTW                   *logfont,
 	case CAIRO_ANTIALIAS_GRAY:
 	case CAIRO_ANTIALIAS_FAST:
 	case CAIRO_ANTIALIAS_GOOD:
-	    f->quality = ANTIALIASED_QUALITY;
+	    f->quality = DEFAULT_QUALITY;
 	    break;
 	case CAIRO_ANTIALIAS_SUBPIXEL:
 	case CAIRO_ANTIALIAS_BEST:

This issue seems a Windows API issue.
Comment 8 Fujii Hironori 2020-06-24 01:31:49 PDT
Created attachment 402627 [details]
Patch
Comment 9 Fujii Hironori 2020-06-24 01:32:24 PDT
Created attachment 402628 [details]
[screenshot] https://www.apple.com/ in WinCairo with the proposed patch
Comment 10 Alex Christensen 2020-06-24 11:16:30 PDT
Comment on attachment 402627 [details]
Patch

This seems fine.
Comment 11 Fujii Hironori 2020-06-24 12:58:02 PDT
Committed r263471: <https://trac.webkit.org/changeset/263471>
Comment 12 Radar WebKit Bug Importer 2020-06-24 12:58:17 PDT
<rdar://problem/64716389>