[Regression] Webkit "-apple-system" font fallback token handles font weights of PingF...
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Oct 2017 00:34:23 +0000 (00:34 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Oct 2017 00:34:23 +0000 (00:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177345
<rdar://problem/32975942>

Reviewed by Jon Lee.

Source/WebCore:

This bug has a fairly insideous cause. In particular, the system font fallback path follows
system conventions, which are not the same as the CSS fallback path. For example, the Chinese
fallback of San Francisco weight 600 is Ping Fang weight 500. This doesn't match our
assumptions in CSS, because Ping Fang does have a 600 weight, which CSS would think is closer.
However, the whole point of system-ui is that it follows the system fallback path, not CSS's.
Therefore, falling back from a bold system-ui request to a non-bold fallback font is correct
and expected, and we shouldn't synthesize bold in this situation.

Test: fast/text/system-ui-chinese-bold-fallback.html

* platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
(WebCore::FontFamilySpecificationCoreText::fontRanges const):

LayoutTests:

* fast/text/system-ui-chinese-bold-fallback.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223589 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp
fast/text/system-ui-chinese-bold-fallback-expected.html [new file with mode: 0644]
fast/text/system-ui-chinese-bold-fallback.html [new file with mode: 0644]

index ae22e12..aa87619 100644 (file)
@@ -1,3 +1,13 @@
+2017-10-17  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Regression] Webkit "-apple-system" font fallback token handles font weights of PingFang incorrectly.
+        https://bugs.webkit.org/show_bug.cgi?id=177345
+        <rdar://problem/32975942>
+
+        Reviewed by Jon Lee.
+
+        * fast/text/system-ui-chinese-bold-fallback.html:
+
 2017-10-17  Dean Jackson  <dino@apple.com>
 
         webgl/1.0.2/conformance/canvas/drawingbuffer-static-canvas-test.html failing
index 74d1d12..fa2e021 100644 (file)
@@ -1,3 +1,24 @@
+2017-10-17  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Regression] Webkit "-apple-system" font fallback token handles font weights of PingFang incorrectly.
+        https://bugs.webkit.org/show_bug.cgi?id=177345
+        <rdar://problem/32975942>
+
+        Reviewed by Jon Lee.
+
+        This bug has a fairly insideous cause. In particular, the system font fallback path follows
+        system conventions, which are not the same as the CSS fallback path. For example, the Chinese
+        fallback of San Francisco weight 600 is Ping Fang weight 500. This doesn't match our
+        assumptions in CSS, because Ping Fang does have a 600 weight, which CSS would think is closer.
+        However, the whole point of system-ui is that it follows the system fallback path, not CSS's.
+        Therefore, falling back from a bold system-ui request to a non-bold fallback font is correct
+        and expected, and we shouldn't synthesize bold in this situation.
+
+        Test: fast/text/system-ui-chinese-bold-fallback.html
+
+        * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
+        (WebCore::FontFamilySpecificationCoreText::fontRanges const):
+
 2017-10-17  Chelsea Pugh  <cpugh@apple.com>
 
         [iOS] Don't turn fields yellow after filling credentials
index e95288a..3c59443 100644 (file)
@@ -60,7 +60,7 @@ FontRanges FontFamilySpecificationCoreText::fontRanges(const FontDescription& fo
     bool syntheticBold, syntheticOblique;
     std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(fontForSynthesisComputation.get(), fontDescription).boldObliquePair();
 
-    FontPlatformData fontPlatformData(font.get(), size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.textRenderingMode());
+    FontPlatformData fontPlatformData(font.get(), size, false, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.textRenderingMode());
 
     return FontRanges(FontCache::singleton().fontForPlatformData(fontPlatformData));
 }
diff --git a/fast/text/system-ui-chinese-bold-fallback-expected.html b/fast/text/system-ui-chinese-bold-fallback-expected.html
new file mode 100644 (file)
index 0000000..918727a
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This makes sure that drawing Chinese characters in a weight 600 system font doesn't cause synthetic bold.
+<div style="font: 600 16px system-ui; font-synthesis: none;">&#x4eca;</div>
+</body>
+</html>
diff --git a/fast/text/system-ui-chinese-bold-fallback.html b/fast/text/system-ui-chinese-bold-fallback.html
new file mode 100644 (file)
index 0000000..a361d4a
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This makes sure that drawing Chinese characters in a weight 600 system font doesn't cause synthetic bold.
+<div style="font: 600 16px system-ui;">&#x4eca;</div>
+</body>
+</html>