Title: [186001] trunk
Revision
186001
Author
mmaxfi...@apple.com
Date
2015-06-26 10:27:32 -0700 (Fri, 26 Jun 2015)

Log Message

[Cocoa] Sans-serif generic font family should map to PingFang
https://bugs.webkit.org/show_bug.cgi?id=146333
<rdar://problem/21521217>

Patch by Myles C. Maxfield <mmaxfi...@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:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (186000 => 186001)


--- trunk/LayoutTests/ChangeLog	2015-06-26 17:09:57 UTC (rev 186000)
+++ trunk/LayoutTests/ChangeLog	2015-06-26 17:27:32 UTC (rev 186001)
@@ -1,3 +1,20 @@
+2015-06-26  Myles C. Maxfield  <mmaxfi...@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  <ddkil...@apple.com>
 
         REGRESSION (r185971): js/dom/global-constructors-attributes.html fails on Windows

Added: trunk/LayoutTests/fast/text/han-generic-font-families.html (0 => 186001)


--- trunk/LayoutTests/fast/text/han-generic-font-families.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/han-generic-font-families.html	2015-06-26 17:27:32 UTC (rev 186001)
@@ -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>

Modified: trunk/LayoutTests/platform/efl/TestExpectations (186000 => 186001)


--- trunk/LayoutTests/platform/efl/TestExpectations	2015-06-26 17:09:57 UTC (rev 186000)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2015-06-26 17:27:32 UTC (rev 186001)
@@ -2276,3 +2276,6 @@
 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 ]

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (186000 => 186001)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2015-06-26 17:09:57 UTC (rev 186000)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2015-06-26 17:27:32 UTC (rev 186001)
@@ -2399,3 +2399,6 @@
 
 # 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 ]

Added: trunk/LayoutTests/platform/ios-simulator/fast/text/han-generic-font-families-expected.html (0 => 186001)


--- trunk/LayoutTests/platform/ios-simulator/fast/text/han-generic-font-families-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/text/han-generic-font-families-expected.html	2015-06-26 17:27:32 UTC (rev 186001)
@@ -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>

Added: trunk/LayoutTests/platform/mac/fast/text/han-generic-font-families-expected.html (0 => 186001)


--- trunk/LayoutTests/platform/mac/fast/text/han-generic-font-families-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/han-generic-font-families-expected.html	2015-06-26 17:27:32 UTC (rev 186001)
@@ -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>

Added: trunk/LayoutTests/platform/mac-mavericks/fast/text/han-generic-font-families-expected.html (0 => 186001)


--- trunk/LayoutTests/platform/mac-mavericks/fast/text/han-generic-font-families-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-mavericks/fast/text/han-generic-font-families-expected.html	2015-06-26 17:27:32 UTC (rev 186001)
@@ -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>

Added: trunk/LayoutTests/platform/mac-yosemite/fast/text/han-generic-font-families-expected.html (0 => 186001)


--- trunk/LayoutTests/platform/mac-yosemite/fast/text/han-generic-font-families-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-yosemite/fast/text/han-generic-font-families-expected.html	2015-06-26 17:27:32 UTC (rev 186001)
@@ -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>

Modified: trunk/LayoutTests/platform/win/TestExpectations (186000 => 186001)


--- trunk/LayoutTests/platform/win/TestExpectations	2015-06-26 17:09:57 UTC (rev 186000)
+++ trunk/LayoutTests/platform/win/TestExpectations	2015-06-26 17:27:32 UTC (rev 186001)
@@ -3110,3 +3110,6 @@
 
 #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 ]

Modified: trunk/Source/WebCore/ChangeLog (186000 => 186001)


--- trunk/Source/WebCore/ChangeLog	2015-06-26 17:09:57 UTC (rev 186000)
+++ trunk/Source/WebCore/ChangeLog	2015-06-26 17:27:32 UTC (rev 186001)
@@ -1,3 +1,20 @@
+2015-06-26  Myles C. Maxfield  <mmaxfi...@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  <pe...@outlook.com>
 
         [Curl] Compile errors; ResourceResponseBase::resourceLoadTiming() has changed return type.

Modified: trunk/Source/WebCore/page/mac/SettingsMac.mm (186000 => 186001)


--- trunk/Source/WebCore/page/mac/SettingsMac.mm	2015-06-26 17:09:57 UTC (rev 186000)
+++ trunk/Source/WebCore/page/mac/SettingsMac.mm	2015-06-26 17:27:32 UTC (rev 186001)
@@ -28,60 +28,85 @@
 
 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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to