Bug 206573

Summary: [WinCairo] -webkit-font-smoothing:antialiased makes fonts blurry
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: PlatformAssignee: Fujii Hironori <Hironori.Fujii>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, don.olmstead, ross.kirsling, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[Screenshot] Google News (Japan) of WinCairo port (150% display scale factor)
none
test case
none
[screenshot] GMail in WinCairo (with -webkit-font-smoothing support, r254899)
none
[screenshot] GMail in WinCairo (without -webkit-font-smoothing support, r254326)
none
[screenshot] https://www.apple.com/ in WinCairo (with -webkit-font-smoothing support, r254899)
none
Patch
achristensen: review+
[screenshot] https://www.apple.com/ in WinCairo with the proposed patch none

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>