Title: [183653] trunk
Revision
183653
Author
d...@apple.com
Date
2015-04-30 16:26:11 -0700 (Thu, 30 Apr 2015)

Log Message

-apple-system-font-monospaced-numbers doesn't work on iOS
https://bugs.webkit.org/show_bug.cgi?id=144478
<rdar://problem/20544940>

Reviewed by Brent Fulgham.

Source/WebCore:

Make sure to start from the system font descriptor when
asking for a monospaced numeric alternate.

Test: platform/ios-simulator/fast/text/system-monospaced-numbers.html

* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::createCTFontWithFamilyNameAndWeight):

LayoutTests:

A test that draws two lines of different numbers and checks
they are the same width.

* platform/ios-simulator/fast/text/system-monospaced-numbers-expected.txt: Added.
* platform/ios-simulator/fast/text/system-monospaced-numbers.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (183652 => 183653)


--- trunk/LayoutTests/ChangeLog	2015-04-30 23:16:22 UTC (rev 183652)
+++ trunk/LayoutTests/ChangeLog	2015-04-30 23:26:11 UTC (rev 183653)
@@ -1,3 +1,17 @@
+2015-04-30  Dean Jackson  <d...@apple.com>
+
+        -apple-system-font-monospaced-numbers doesn't work on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=144478
+        <rdar://problem/20544940>
+
+        Reviewed by Brent Fulgham.
+
+        A test that draws two lines of different numbers and checks
+        they are the same width.
+
+        * platform/ios-simulator/fast/text/system-monospaced-numbers-expected.txt: Added.
+        * platform/ios-simulator/fast/text/system-monospaced-numbers.html: Added.
+
 2015-04-30  Joseph Pecoraro  <pecor...@apple.com>
 
         Unreviewed, ios-simulator gardening

Added: trunk/LayoutTests/platform/ios-simulator/fast/text/system-monospaced-numbers-expected.txt (0 => 183653)


--- trunk/LayoutTests/platform/ios-simulator/fast/text/system-monospaced-numbers-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/text/system-monospaced-numbers-expected.txt	2015-04-30 23:26:11 UTC (rev 183653)
@@ -0,0 +1,7 @@
+These next two lines should be the same width
+
+00:11:22.33
+
+11:11:11.11
+
+PASS: widths were the same
Property changes on: trunk/LayoutTests/platform/ios-simulator/fast/text/system-monospaced-numbers-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/platform/ios-simulator/fast/text/system-monospaced-numbers.html (0 => 183653)


--- trunk/LayoutTests/platform/ios-simulator/fast/text/system-monospaced-numbers.html	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/text/system-monospaced-numbers.html	2015-04-30 23:26:11 UTC (rev 183653)
@@ -0,0 +1,31 @@
+<style>
+span {
+    font-family: -apple-system-font-monospaced-numbers;
+    font-size: 24px
+}
+</style>
+<script>
+if (window.testRunner)
+    window.testRunner.dumpAsText();
+
+window.addEventListener("load", run, false);
+
+function run() {
+    var a = document.getElementById("a");
+    var b = document.getElementById("b");
+    var result = document.getElementById("result");
+
+    var aRect = a.getBoundingClientRect();
+    var bRect = b.getBoundingClientRect();
+
+    if (aRect.width == bRect.width)
+        result.textContent = "PASS: widths were the same";
+    else
+        result.textContent = "FAIL: widths were not the same";
+}
+</script>
+<p>These next two lines should be the same width</p>
+<p><span id="a">00:11:22.33</span></p>
+<p><span id="b">11:11:11.11</span></p>
+
+<p id="result"></p>
Property changes on: trunk/LayoutTests/platform/ios-simulator/fast/text/system-monospaced-numbers.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (183652 => 183653)


--- trunk/Source/WebCore/ChangeLog	2015-04-30 23:16:22 UTC (rev 183652)
+++ trunk/Source/WebCore/ChangeLog	2015-04-30 23:26:11 UTC (rev 183653)
@@ -1,3 +1,19 @@
+2015-04-30  Dean Jackson  <d...@apple.com>
+
+        -apple-system-font-monospaced-numbers doesn't work on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=144478
+        <rdar://problem/20544940>
+
+        Reviewed by Brent Fulgham.
+
+        Make sure to start from the system font descriptor when
+        asking for a monospaced numeric alternate.
+
+        Test: platform/ios-simulator/fast/text/system-monospaced-numbers.html
+
+        * platform/graphics/ios/FontCacheIOS.mm:
+        (WebCore::createCTFontWithFamilyNameAndWeight):
+
 2015-04-30  Oliver Hunt  <oli...@apple.com>
 
         DOM bindings should not be using a reference type to point to a temporary object

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


--- trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2015-04-30 23:16:22 UTC (rev 183652)
+++ trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2015-04-30 23:26:11 UTC (rev 183653)
@@ -625,11 +625,9 @@
 
     static NeverDestroyed<AtomicString> systemUIMonospacedNumbersFontWithApplePrefix("-apple-system-font-monospaced-numbers", AtomicString::ConstructFromLiteral);
     if (equalIgnoringCase(familyName, systemUIMonospacedNumbersFontWithApplePrefix)) {
-        NSDictionary *attributes = @{ (NSString *)kCTFontFeatureTypeIdentifierKey : @(kNumberSpacingType),
-            (NSString *)kCTFontFeatureSelectorIdentifierKey : @(kMonospacedNumbersSelector) };
-
-        RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributesAndOptions((CFDictionaryRef)attributes, kCTFontDescriptorOptionSystemUIFont | kCTFontDescriptorOptionPreferAppleSystemFont));
-        return CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr);
+        RetainPtr<CTFontDescriptorRef> systemFontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontUIFontSystem, size, nullptr));
+        RetainPtr<CTFontDescriptorRef> monospaceFontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithFeature(systemFontDescriptor.get(), (CFNumberRef)@(kNumberSpacingType), (CFNumberRef)@(kMonospacedNumbersSelector)));
+        return CTFontCreateWithFontDescriptor(monospaceFontDescriptor.get(), size, nullptr);
     }
 
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to