Title: [185217] trunk/Source/WebCore
Revision
185217
Author
mmaxfi...@apple.com
Date
2015-06-04 14:08:25 -0700 (Thu, 04 Jun 2015)

Log Message

[Cocoa] Remove unnecessary code from FontPlatformData::ctFont()
https://bugs.webkit.org/show_bug.cgi?id=145652

Hoefler Text Italic no longer has initial and final swashes by default, so there
is no reason to explicitly disable them.

Reviewed by Andreas Kling.

No new tests because there is no behavior change.

* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::ctFont):
(WebCore::createFeatureSettingDictionary): Deleted.
(WebCore::cascadeToLastResortAndDisableSwashesFontDescriptor): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (185216 => 185217)


--- trunk/Source/WebCore/ChangeLog	2015-06-04 20:53:01 UTC (rev 185216)
+++ trunk/Source/WebCore/ChangeLog	2015-06-04 21:08:25 UTC (rev 185217)
@@ -1,3 +1,20 @@
+2015-06-04  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Remove unnecessary code from FontPlatformData::ctFont()
+        https://bugs.webkit.org/show_bug.cgi?id=145652
+
+        Hoefler Text Italic no longer has initial and final swashes by default, so there
+        is no reason to explicitly disable them.
+
+        Reviewed by Andreas Kling.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+        (WebCore::FontPlatformData::ctFont):
+        (WebCore::createFeatureSettingDictionary): Deleted.
+        (WebCore::cascadeToLastResortAndDisableSwashesFontDescriptor): Deleted.
+
 2015-06-04  Brent Fulgham  <bfulg...@apple.com>
 
         Latching algorithm in findEnclosingOverflowScroll is broken

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (185216 => 185217)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2015-06-04 20:53:01 UTC (rev 185216)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2015-06-04 21:08:25 UTC (rev 185217)
@@ -138,17 +138,6 @@
     return TextSpacingProportional;
 }
 
-static CFDictionaryRef createFeatureSettingDictionary(int featureTypeIdentifier, int featureSelectorIdentifier)
-{
-    RetainPtr<CFNumberRef> featureTypeIdentifierNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureTypeIdentifier));
-    RetainPtr<CFNumberRef> featureSelectorIdentifierNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureSelectorIdentifier));
-
-    const void* settingKeys[] = { kCTFontFeatureTypeIdentifierKey, kCTFontFeatureSelectorIdentifierKey };
-    const void* settingValues[] = { featureTypeIdentifierNumber.get(), featureSelectorIdentifierNumber.get() };
-
-    return CFDictionaryCreate(kCFAllocatorDefault, settingKeys, settingValues, WTF_ARRAY_LENGTH(settingKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-}
-
 static CTFontDescriptorRef cascadeToLastResortFontDescriptor()
 {
     static CTFontDescriptorRef descriptor;
@@ -169,27 +158,6 @@
     return descriptor;
 }
 
-static CTFontDescriptorRef cascadeToLastResortAndDisableSwashesFontDescriptor()
-{
-    static CTFontDescriptorRef descriptor;
-    if (descriptor)
-        return descriptor;
-
-    RetainPtr<CFDictionaryRef> lineInitialSwashesOffSetting = adoptCF(createFeatureSettingDictionary(kSmartSwashType, kLineInitialSwashesOffSelector));
-    RetainPtr<CFDictionaryRef> lineFinalSwashesOffSetting = adoptCF(createFeatureSettingDictionary(kSmartSwashType, kLineFinalSwashesOffSelector));
-
-    const void* settingDictionaries[] = { lineInitialSwashesOffSetting.get(), lineFinalSwashesOffSetting.get() };
-    RetainPtr<CFArrayRef> featureSettings = adoptCF(CFArrayCreate(kCFAllocatorDefault, settingDictionaries, WTF_ARRAY_LENGTH(settingDictionaries), &kCFTypeArrayCallBacks));
-
-    const void* keys[] = { kCTFontFeatureSettingsAttribute };
-    const void* values[] = { featureSettings.get() };
-    RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
-
-    descriptor = CTFontDescriptorCreateCopyWithAttributes(cascadeToLastResortFontDescriptor(), attributes.get());
-
-    return descriptor;
-}
-
 CGFloat FontPlatformData::ctFontSize() const
 {
     // On iOS, Apple Color Emoji size is adjusted (and then re-adjusted by Core Text) and capped.
@@ -206,11 +174,7 @@
     if (m_ctFont) {
         CTFontDescriptorRef fontDescriptor;
         RetainPtr<CFStringRef> postScriptName = adoptCF(CTFontCopyPostScriptName(m_ctFont.get()));
-        // Hoefler Text Italic has line-initial and -final swashes enabled by default, so disable them.
-        if (CFEqual(postScriptName.get(), CFSTR("HoeflerText-Italic")) || CFEqual(postScriptName.get(), CFSTR("HoeflerText-BlackItalic")))
-            fontDescriptor = cascadeToLastResortAndDisableSwashesFontDescriptor();
-        else
-            fontDescriptor = cascadeToLastResortFontDescriptor();
+        fontDescriptor = cascadeToLastResortFontDescriptor();
         m_ctFont = adoptCF(CTFontCreateCopyWithAttributes(m_ctFont.get(), ctFontSize(), 0, fontDescriptor));
     } else
         m_ctFont = adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), ctFontSize(), 0, cascadeToLastResortFontDescriptor()));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to