Title: [210597] trunk/Source/WebCore
Revision
210597
Author
mmaxfi...@apple.com
Date
2017-01-11 13:40:12 -0800 (Wed, 11 Jan 2017)

Log Message

[Cocoa] Testing fix after r210591
https://bugs.webkit.org/show_bug.cgi?id=166672

Unreviewed.

Fixes fast/text/trak-optimizeLegibility.html and
fast/text/system-font-features.html

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::fontIsSystemFont):
(WebCore::preparePlatformFont):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (210596 => 210597)


--- trunk/Source/WebCore/ChangeLog	2017-01-11 21:28:01 UTC (rev 210596)
+++ trunk/Source/WebCore/ChangeLog	2017-01-11 21:40:12 UTC (rev 210597)
@@ -1,3 +1,17 @@
+2017-01-11  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Testing fix after r210591
+        https://bugs.webkit.org/show_bug.cgi?id=166672
+
+        Unreviewed.
+
+        Fixes fast/text/trak-optimizeLegibility.html and
+        fast/text/system-font-features.html
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::fontIsSystemFont):
+        (WebCore::preparePlatformFont):
+
 2017-01-11  Chris Dumez  <cdu...@apple.com>
 
         Iterating over URLSearchParams does not work

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (210596 => 210597)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2017-01-11 21:28:01 UTC (rev 210596)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2017-01-11 21:40:12 UTC (rev 210597)
@@ -419,6 +419,14 @@
 }
 #endif
 
+static inline bool fontIsSystemFont(CTFontRef font)
+{
+    if (CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(font)).get()))
+        return true;
+    auto name = adoptCF(CTFontCopyPostScriptName(font));
+    return CFStringGetLength(name.get()) > 0 && CFStringGetCharacterAtIndex(name.get(), 0) == '.';
+}
+
 RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, TextRenderingMode textRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const FontFeatureSettings& features, const FontVariantSettings& variantSettings, const FontVariationSettings& variations)
 {
     bool alwaysAddVariations = false;
@@ -428,8 +436,7 @@
 #if ENABLE(VARIATION_FONTS)
     auto defaultValues = defaultVariationValues(originalFont);
 #if WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
-    bool isSystemFont = CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(originalFont)).get());
-    alwaysAddVariations = !isSystemFont && !defaultValues.isEmpty();
+    alwaysAddVariations = !defaultValues.isEmpty();
 #endif
 #endif
 
@@ -495,9 +502,11 @@
     }
 
 #if WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
-    for (auto& defaultValue : defaultValues) {
-        if (!variationsToBeApplied.contains(defaultValue.key))
-            applyVariationValue(defaultValue.key, defaultValue.value.defaultValue, true);
+    if (!fontIsSystemFont(originalFont)) {
+        for (auto& defaultValue : defaultValues) {
+            if (!variationsToBeApplied.contains(defaultValue.key))
+                applyVariationValue(defaultValue.key, defaultValue.value.defaultValue, true);
+        }
     }
 #endif
 #undef WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to