Title: [176971] trunk
Revision
176971
Author
mmaxfi...@apple.com
Date
2014-12-08 14:10:40 -0800 (Mon, 08 Dec 2014)

Log Message

[iOS] Narrow non-breaking space does not fall back to a correct font
https://bugs.webkit.org/show_bug.cgi?id=139335

Reviewed by Enrica Casucci.

Source/WebCore:

Test: fast/text/narrow-non-breaking-space.html

* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::requiresCustomFallbackFont):
(WebCore::FontCache::getCustomFallbackFont):

LayoutTests:

* fast/text/narrow-non-breaking-space-expected.html: Added.
* fast/text/narrow-non-breaking-space.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176970 => 176971)


--- trunk/LayoutTests/ChangeLog	2014-12-08 22:06:02 UTC (rev 176970)
+++ trunk/LayoutTests/ChangeLog	2014-12-08 22:10:40 UTC (rev 176971)
@@ -1,3 +1,13 @@
+2014-12-08  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [iOS] Narrow non-breaking space does not fall back to a correct font
+        https://bugs.webkit.org/show_bug.cgi?id=139335
+
+        Reviewed by Enrica Casucci.
+
+        * fast/text/narrow-non-breaking-space-expected.html: Added.
+        * fast/text/narrow-non-breaking-space.html: Added.
+
 2014-12-08  Javier Fernandez  <jfernan...@igalia.com>
 
         [CSS Grid Layout] Grid items must set a new formatting context.

Added: trunk/LayoutTests/fast/text/narrow-non-breaking-space-expected.html (0 => 176971)


--- trunk/LayoutTests/fast/text/narrow-non-breaking-space-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/narrow-non-breaking-space-expected.html	2014-12-08 22:10:40 UTC (rev 176971)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html style="-webkit-writing-mode: vertical-rl; font-family: STHeitiTC-Light, 'Heiti TC';">
+<body>
+This test makes sure that a narrow non-breaking space does not draw as a .notdef character.
+This character is a U+202f narrow non-breaking space: ""
+</body>
+</html>
+

Added: trunk/LayoutTests/fast/text/narrow-non-breaking-space.html (0 => 176971)


--- trunk/LayoutTests/fast/text/narrow-non-breaking-space.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/narrow-non-breaking-space.html	2014-12-08 22:10:40 UTC (rev 176971)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html style="-webkit-writing-mode: vertical-rl; font-family: STHeitiTC-Light, 'Heiti TC';">
+<body>
+This test makes sure that a narrow non-breaking space does not draw as a .notdef character.
+This character is a U+202f narrow non-breaking space: "&#x202f;"
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (176970 => 176971)


--- trunk/Source/WebCore/ChangeLog	2014-12-08 22:06:02 UTC (rev 176970)
+++ trunk/Source/WebCore/ChangeLog	2014-12-08 22:10:40 UTC (rev 176971)
@@ -1,3 +1,16 @@
+2014-12-08  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [iOS] Narrow non-breaking space does not fall back to a correct font
+        https://bugs.webkit.org/show_bug.cgi?id=139335
+
+        Reviewed by Enrica Casucci.
+
+        Test: fast/text/narrow-non-breaking-space.html
+
+        * platform/graphics/ios/FontCacheIOS.mm:
+        (WebCore::requiresCustomFallbackFont):
+        (WebCore::FontCache::getCustomFallbackFont):
+
 2014-12-08  Daniel Bates  <daba...@apple.com>
 
         [iOS] Fix the WebKit build with the public SDK

Modified: trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (176970 => 176971)


--- trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2014-12-08 22:06:02 UTC (rev 176970)
+++ trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2014-12-08 22:10:40 UTC (rev 176971)
@@ -50,7 +50,7 @@
 
 static inline bool requiresCustomFallbackFont(const UInt32 character)
 {
-    return character == AppleLogo || character == blackCircle;
+    return character == AppleLogo || character == blackCircle || character == narrowNonBreakingSpace;
 }
 
 static CFCharacterSetRef copyFontCharacterSet(CFStringRef fontName)
@@ -487,15 +487,30 @@
 FontPlatformData* FontCache::getCustomFallbackFont(const UInt32 c, const FontDescription& description)
 {
     ASSERT(requiresCustomFallbackFont(c));
-    if (c == AppleLogo) {
-        static NeverDestroyed<AtomicString> helveticaFamily("Helvetica Neue", AtomicString::ConstructFromLiteral);
-        return getCachedFontPlatformData(description, helveticaFamily);
+
+    static NeverDestroyed<AtomicString> helveticaFamily("Helvetica Neue", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<AtomicString> lockClockFamily("LockClock-Light", AtomicString::ConstructFromLiteral);
+    static NeverDestroyed<AtomicString> timesNewRomanPSMTFamily("TimesNewRomanPSMT", AtomicString::ConstructFromLiteral);
+
+    AtomicString* family = nullptr;
+    switch (c) {
+    case AppleLogo:
+        family = &helveticaFamily.get();
+        break;
+    case blackCircle:
+        family = &lockClockFamily.get();
+        break;
+    case narrowNonBreakingSpace:
+        family = &timesNewRomanPSMTFamily.get();
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        return nullptr;
     }
-    if (c == blackCircle) {
-        static NeverDestroyed<AtomicString> lockClockFamily("LockClock-Light", AtomicString::ConstructFromLiteral);
-        return getCachedFontPlatformData(description, lockClockFamily);
-    }
-    return nullptr;
+    ASSERT(family);
+    if (!family)
+        return nullptr;
+    return getCachedFontPlatformData(description, *family);
 }
 
 static inline FontTraitsMask toTraitsMask(CTFontSymbolicTraits ctFontTraits)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to