[Cocoa] Sans-serif generic font family should map to PingFang
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Jun 2015 17:27:32 +0000 (17:27 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Jun 2015 17:27:32 +0000 (17:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146333
<rdar://problem/21521217>

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2015-06-26
Reviewed by Alexey Proskuryakov.

Source/WebCore:

Also performs a little bit of cleanup.

Test: fast/text/han-generic-font-families.html

* page/mac/SettingsMac.mm:
(WebCore::sansSerifTraditionalHanFontFamily):
(WebCore::sansSerifSimplifiedHanFontFamily):
(WebCore::Settings::initializeDefaultFontFamilies):

LayoutTests:

* fast/text/han-generic-font-families.html: Added.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/ios-simulator/fast/text/han-generic-font-families-expected.html: Added.
* platform/mac-mavericks/fast/text/han-generic-font-families-expected.html: Added.
* platform/mac-yosemite/fast/text/han-generic-font-families-expected.html: Added.
* platform/mac/fast/text/han-generic-font-families-expected.html: Added.
* platform/win/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/fast/text/han-generic-font-families.html [new file with mode: 0644]
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios-simulator/fast/text/han-generic-font-families-expected.html [new file with mode: 0644]
LayoutTests/platform/mac-mavericks/fast/text/han-generic-font-families-expected.html [new file with mode: 0644]
LayoutTests/platform/mac-yosemite/fast/text/han-generic-font-families-expected.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/han-generic-font-families-expected.html [new file with mode: 0644]
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/page/mac/SettingsMac.mm

index 76e63d73e90b4c777072e205d36bb1aae1a2ac20..1a77d4d259722eda22cab83f2d49e5410b406856 100644 (file)
@@ -1,3 +1,20 @@
+2015-06-26  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Sans-serif generic font family should map to PingFang
+        https://bugs.webkit.org/show_bug.cgi?id=146333
+        <rdar://problem/21521217>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * fast/text/han-generic-font-families.html: Added.
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/ios-simulator/fast/text/han-generic-font-families-expected.html: Added.
+        * platform/mac-mavericks/fast/text/han-generic-font-families-expected.html: Added.
+        * platform/mac-yosemite/fast/text/han-generic-font-families-expected.html: Added.
+        * platform/mac/fast/text/han-generic-font-families-expected.html: Added.
+        * platform/win/TestExpectations:
+
 2015-06-26  David Kilzer  <ddkilzer@apple.com>
 
         REGRESSION (r185971): js/dom/global-constructors-attributes.html fails on Windows
diff --git a/LayoutTests/fast/text/han-generic-font-families.html b/LayoutTests/fast/text/han-generic-font-families.html
new file mode 100644 (file)
index 0000000..5bcebd3
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="zh-HK">
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test is designed to test WebKit's mappings for the generic font families for Han scripts.
+<div style="font-size: 50px; font-family: serif;">此段中文简体文本用于浏览器布局测试</div>
+<div style="font-size: 50px; font-family: serif;">此段繁體中文文本用於瀏覽器佈局測試</div>
+<div style="font-size: 50px; font-family: sans-serif;">&#x5d6a;&#x5d6a;&#x50fa;&#x671c;&#x9a5d;&#x9aaa;&#x5e51;&#x8522;&#x54ec;&#x5eeb;&#x85bc;&#x61a0;&#x7641;&#x6f9a;</div>
+<div style="font-size: 50px; font-family: sans-serif;">&#x9fa9;&#x9faf;&#x9fc7;&#x9faa;&#x9fb0;&#x9fc8;&#x9fab;&#x9fb1;&#x9fc9;&#x9fa6;&#x9fac;&#x9fb2;&#x9fca;&#x9fa7;</div>
+</body>
+</html>
index 7c08b71a4e28cb7532f194c8bca49ccbe6045eee..f46040bf9401abedd876540c8cf3f72c5a6f956e 100644 (file)
@@ -2276,3 +2276,6 @@ accessibility/transformed-element.html [ Failure ]
 webkit.org/b/146139 fast/css/named-images.html [ Missing ]
 
 webkit.org/b/146233 fast/forms/listbox-visible-size.html [ Failure ]
+
+# Test requires hardcoded font names, which I do not have for this port.
+fast/text/han-generic-font-families.html [ WontFix ]
index 0f4f6dab983f3b2b51872570cb10d877aa364981..d5521e82050fce43e79c7534f44e8cbdf8c0c851 100644 (file)
@@ -2399,3 +2399,6 @@ transitions/svg-text-shadow-transition.html [ Pass ]
 
 # This requires a specific font on Mac
 fast/text/hidpi-text-selection-gap-between-words.html [ Skip ]
+
+# Test requires hardcoded font names, which I do not have for this port.
+fast/text/han-generic-font-families.html [ WontFix ]
diff --git a/LayoutTests/platform/ios-simulator/fast/text/han-generic-font-families-expected.html b/LayoutTests/platform/ios-simulator/fast/text/han-generic-font-families-expected.html
new file mode 100644 (file)
index 0000000..541d4f2
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="zh-HK">
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test is designed to test WebKit's mappings for the generic font families for Han scripts.
+<div style="font-size: 50px; font-family: 'PingFang SC';">此段中文简体文本用于浏览器布局测试</div>
+<div style="font-size: 50px; font-family: 'PingFang TC';">此段繁體中文文本用於瀏覽器佈局測試</div>
+<div style="font-size: 50px; font-family: 'PingFang SC';">&#x5d6a;&#x5d6a;&#x50fa;&#x671c;&#x9a5d;&#x9aaa;&#x5e51;&#x8522;&#x54ec;&#x5eeb;&#x85bc;&#x61a0;&#x7641;&#x6f9a;</div>
+<div style="font-size: 50px; font-family: 'PingFang TC';">&#x9fa9;&#x9faf;&#x9fc7;&#x9faa;&#x9fb0;&#x9fc8;&#x9fab;&#x9fb1;&#x9fc9;&#x9fa6;&#x9fac;&#x9fb2;&#x9fca;&#x9fa7;</div>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac-mavericks/fast/text/han-generic-font-families-expected.html b/LayoutTests/platform/mac-mavericks/fast/text/han-generic-font-families-expected.html
new file mode 100644 (file)
index 0000000..a9e80e4
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="zh-HK">
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test is designed to test WebKit's mappings for the generic font families for Han scripts.
+<div style="font-size: 50px; font-family: 'Songti SC';">此段中文简体文本用于浏览器布局测试</div>
+<div style="font-size: 50px; font-family: 'Songti TC';">此段繁體中文文本用於瀏覽器佈局測試</div>
+<div style="font-size: 50px; font-family: 'Heiti SC';">&#x5d6a;&#x5d6a;&#x50fa;&#x671c;&#x9a5d;&#x9aaa;&#x5e51;&#x8522;&#x54ec;&#x5eeb;&#x85bc;&#x61a0;&#x7641;&#x6f9a;</div>
+<div style="font-size: 50px; font-family: 'Heiti TC';">&#x9fa9;&#x9faf;&#x9fc7;&#x9faa;&#x9fb0;&#x9fc8;&#x9fab;&#x9fb1;&#x9fc9;&#x9fa6;&#x9fac;&#x9fb2;&#x9fca;&#x9fa7;</div>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac-yosemite/fast/text/han-generic-font-families-expected.html b/LayoutTests/platform/mac-yosemite/fast/text/han-generic-font-families-expected.html
new file mode 100644 (file)
index 0000000..a9e80e4
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="zh-HK">
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test is designed to test WebKit's mappings for the generic font families for Han scripts.
+<div style="font-size: 50px; font-family: 'Songti SC';">此段中文简体文本用于浏览器布局测试</div>
+<div style="font-size: 50px; font-family: 'Songti TC';">此段繁體中文文本用於瀏覽器佈局測試</div>
+<div style="font-size: 50px; font-family: 'Heiti SC';">&#x5d6a;&#x5d6a;&#x50fa;&#x671c;&#x9a5d;&#x9aaa;&#x5e51;&#x8522;&#x54ec;&#x5eeb;&#x85bc;&#x61a0;&#x7641;&#x6f9a;</div>
+<div style="font-size: 50px; font-family: 'Heiti TC';">&#x9fa9;&#x9faf;&#x9fc7;&#x9faa;&#x9fb0;&#x9fc8;&#x9fab;&#x9fb1;&#x9fc9;&#x9fa6;&#x9fac;&#x9fb2;&#x9fca;&#x9fa7;</div>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/text/han-generic-font-families-expected.html b/LayoutTests/platform/mac/fast/text/han-generic-font-families-expected.html
new file mode 100644 (file)
index 0000000..6425446
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="zh-HK">
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test is designed to test WebKit's mappings for the generic font families for Han scripts.
+<div style="font-size: 50px; font-family: 'Songti SC';">此段中文简体文本用于浏览器布局测试</div>
+<div style="font-size: 50px; font-family: 'Songti TC';">此段繁體中文文本用於瀏覽器佈局測試</div>
+<div style="font-size: 50px; font-family: 'PingFang SC';">&#x5d6a;&#x5d6a;&#x50fa;&#x671c;&#x9a5d;&#x9aaa;&#x5e51;&#x8522;&#x54ec;&#x5eeb;&#x85bc;&#x61a0;&#x7641;&#x6f9a;</div>
+<div style="font-size: 50px; font-family: 'PingFang TC';">&#x9fa9;&#x9faf;&#x9fc7;&#x9faa;&#x9fb0;&#x9fc8;&#x9fab;&#x9fb1;&#x9fc9;&#x9fa6;&#x9fac;&#x9fb2;&#x9fca;&#x9fa7;</div>
+</body>
+</html>
index 826bbea75d7e19dabf0219b8d45dd3331af07a64..b961876bb5e59a52d6485871050d6c37617ad922 100644 (file)
@@ -3110,3 +3110,6 @@ loader/navigation-policy [ Skip ]
 
 #Subpixel difference
 fast/text/decorations-vertical-underline.html [ Skip ]
+
+# Test requires hardcoded font names, which I do not have for this port.
+fast/text/han-generic-font-families.html [ WontFix ]
index 74d381269705d892be483e6ed3ba332b293d3493..88dded502e3d40182ddc600126cff5b921f836cf 100644 (file)
@@ -1,3 +1,20 @@
+2015-06-26  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Sans-serif generic font family should map to PingFang
+        https://bugs.webkit.org/show_bug.cgi?id=146333
+        <rdar://problem/21521217>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Also performs a little bit of cleanup.
+
+        Test: fast/text/han-generic-font-families.html
+
+        * page/mac/SettingsMac.mm:
+        (WebCore::sansSerifTraditionalHanFontFamily):
+        (WebCore::sansSerifSimplifiedHanFontFamily):
+        (WebCore::Settings::initializeDefaultFontFamilies):
+
 2015-06-26  Per Arne Vollan  <peavo@outlook.com>
 
         [Curl] Compile errors; ResourceResponseBase::resourceLoadTiming() has changed return type.
index 2fc6c2e65f3a5b95a743ca2009fbbaac3513d87b..4ce4184d316fffb864eef87f5caf52213e3ff8dd 100644 (file)
 
 namespace WebCore {
 
+static inline const char* sansSerifTraditionalHanFontFamily()
+{
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000)
+    return "PingFang TC";
+#else
+    return "Heiti TC";
+#endif
+}
+
+static inline const char* sansSerifSimplifiedHanFontFamily()
+{
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000)
+    return "PingFang SC";
+#else
+    return "Heiti SC";
+#endif
+}
+
+#if PLATFORM(MAC)
 void Settings::initializeDefaultFontFamilies()
 {
-#if !PLATFORM(IOS)
     setStandardFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN);
     setSerifFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN);
-#else
-    // There is no serif Chinese font in default iOS installation.
-    setStandardFontFamily("Heiti TC", USCRIPT_TRADITIONAL_HAN);
-    setSerifFontFamily("Heiti TC", USCRIPT_TRADITIONAL_HAN);
-#endif
-    setFixedFontFamily("Heiti TC", USCRIPT_TRADITIONAL_HAN);
-    setSansSerifFontFamily("Heiti TC", USCRIPT_TRADITIONAL_HAN);
+    setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+    setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
 
-#if !PLATFORM(IOS)
     setStandardFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN);
     setSerifFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN);
-#else
-    // There is no serif Chinese font in default iOS installation.
-    setStandardFontFamily("Heiti SC", USCRIPT_SIMPLIFIED_HAN);
-    setSerifFontFamily("Heiti SC", USCRIPT_SIMPLIFIED_HAN);
-#endif
-    setFixedFontFamily("Heiti SC", USCRIPT_SIMPLIFIED_HAN);
-    setSansSerifFontFamily("Heiti SC", USCRIPT_SIMPLIFIED_HAN);
+    setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+    setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
 
     setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
-#if !PLATFORM(IOS)
     setFixedFontFamily("Osaka-Mono", USCRIPT_KATAKANA_OR_HIRAGANA);
-#else
-    setFixedFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
-#endif
     setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
     setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
 
-#if !PLATFORM(IOS)
     setStandardFontFamily("AppleMyungjo", USCRIPT_HANGUL);
     setSerifFontFamily("AppleMyungjo", USCRIPT_HANGUL);
+    setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
+    setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
+
+    setStandardFontFamily("Times", USCRIPT_COMMON);
+    setFixedFontFamily("Courier", USCRIPT_COMMON);
+    setSerifFontFamily("Times", USCRIPT_COMMON);
+    setSansSerifFontFamily("Helvetica", USCRIPT_COMMON);
+}
+
 #else
+
+void Settings::initializeDefaultFontFamilies()
+{
+    // There is no serif Chinese font in default iOS installation.
+    setStandardFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+    setSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+    setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+    setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);
+
+    // There is no serif Chinese font in default iOS installation.
+    setStandardFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+    setSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+    setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+    setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
+
+    setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+    setFixedFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+    setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+    setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
+
     // There is no serif Korean font in default iOS installation.
     setStandardFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
     setSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
-#endif
-#if PLATFORM(COCOA)
-    setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
-    setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);
-#else
     setFixedFontFamily("AppleGothic", USCRIPT_HANGUL);
     setSansSerifFontFamily("AppleGothic", USCRIPT_HANGUL);
-#endif
 
     setStandardFontFamily("Times", USCRIPT_COMMON);
     setFixedFontFamily("Courier", USCRIPT_COMMON);
     setSerifFontFamily("Times", USCRIPT_COMMON);
     setSansSerifFontFamily("Helvetica", USCRIPT_COMMON);
 }
-
+#endif
 
 } // namespace WebCore