Title: [282398] trunk/Source
Revision
282398
Author
[email protected]
Date
2021-09-14 11:42:12 -0700 (Tue, 14 Sep 2021)

Log Message

[Cocoa] Migrate to CTFontHasTable() from CTFontCopyAvailableTables()
https://bugs.webkit.org/show_bug.cgi?id=230248

Reviewed by Anders Carlsson.

Source/WebCore:

CTFontHasTable() has been around for a while, but it's only actually
faster than CTFontCopyAvailableTables() on certain operating systems.

No new tests because there is no behavior change.

* platform/graphics/coretext/FontCoreText.cpp:
(WebCore::fontHasTable):
(WebCore::fontHasEitherTable):

Source/WebCore/PAL:

* pal/spi/cf/CoreTextSPI.h:

Source/WTF:

* wtf/PlatformUse.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (282397 => 282398)


--- trunk/Source/WTF/ChangeLog	2021-09-14 18:38:58 UTC (rev 282397)
+++ trunk/Source/WTF/ChangeLog	2021-09-14 18:42:12 UTC (rev 282398)
@@ -1,3 +1,12 @@
+2021-09-14  Myles C. Maxfield  <[email protected]>
+
+        [Cocoa] Migrate to CTFontHasTable() from CTFontCopyAvailableTables()
+        https://bugs.webkit.org/show_bug.cgi?id=230248
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/PlatformUse.h:
+
 2021-09-13  Alex Christensen  <[email protected]>
 
         Add unit test that uses PCM daemon

Modified: trunk/Source/WTF/wtf/PlatformUse.h (282397 => 282398)


--- trunk/Source/WTF/wtf/PlatformUse.h	2021-09-14 18:38:58 UTC (rev 282397)
+++ trunk/Source/WTF/wtf/PlatformUse.h	2021-09-14 18:42:12 UTC (rev 282398)
@@ -315,6 +315,13 @@
 #define USE_NON_VARIABLE_SYSTEM_FONT 1
 #endif
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000) \
+    || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 160000) \
+    || (PLATFORM(WATCHOS) && !PLATFORM(IOS_FAMILY_SIMULATOR) && __WATCH_OS_VERSION_MIN_REQUIRED >= 90000) \
+    || (PLATFORM(APPLETV) && !PLATFORM(IOS_FAMILY_SIMULATOR) && __TV_OS_VERSION_MIN_REQUIRED >= 160000)
+#define USE_CTFONTHASTABLE 1
+#endif
+
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500
 #define USE_LEGACY_CFNETWORK_DOWNLOADS 1
 #endif

Modified: trunk/Source/WebCore/ChangeLog (282397 => 282398)


--- trunk/Source/WebCore/ChangeLog	2021-09-14 18:38:58 UTC (rev 282397)
+++ trunk/Source/WebCore/ChangeLog	2021-09-14 18:42:12 UTC (rev 282398)
@@ -1,5 +1,21 @@
 2021-09-14  Myles C. Maxfield  <[email protected]>
 
+        [Cocoa] Migrate to CTFontHasTable() from CTFontCopyAvailableTables()
+        https://bugs.webkit.org/show_bug.cgi?id=230248
+
+        Reviewed by Anders Carlsson.
+
+        CTFontHasTable() has been around for a while, but it's only actually
+        faster than CTFontCopyAvailableTables() on certain operating systems.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/coretext/FontCoreText.cpp:
+        (WebCore::fontHasTable):
+        (WebCore::fontHasEitherTable):
+
+2021-09-14  Myles C. Maxfield  <[email protected]>
+
         Implement text-decoration-skip-ink
         https://bugs.webkit.org/show_bug.cgi?id=230244
 

Modified: trunk/Source/WebCore/PAL/ChangeLog (282397 => 282398)


--- trunk/Source/WebCore/PAL/ChangeLog	2021-09-14 18:38:58 UTC (rev 282397)
+++ trunk/Source/WebCore/PAL/ChangeLog	2021-09-14 18:42:12 UTC (rev 282398)
@@ -1,3 +1,12 @@
+2021-09-14  Myles C. Maxfield  <[email protected]>
+
+        [Cocoa] Migrate to CTFontHasTable() from CTFontCopyAvailableTables()
+        https://bugs.webkit.org/show_bug.cgi?id=230248
+
+        Reviewed by Anders Carlsson.
+
+        * pal/spi/cf/CoreTextSPI.h:
+
 2021-09-11  David Kilzer  <[email protected]>
 
         CFNotificationCenterAddObserver() should use weak observers

Modified: trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h (282397 => 282398)


--- trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h	2021-09-14 18:38:58 UTC (rev 282397)
+++ trunk/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h	2021-09-14 18:42:12 UTC (rev 282398)
@@ -124,6 +124,8 @@
 CTFontDescriptorRef CTFontDescriptorCreateForCSSFamily(CFStringRef cssFamily, CFStringRef language);
 bool CTFontGetGlyphsForCharacterRange(CTFontRef, CGGlyph glyphs[], CFRange);
 
+bool CTFontHasTable(CTFontRef, CTFontTableTag);
+
 CTFontDescriptorRef CTFontDescriptorCreateForUIType(CTFontUIFontType, CGFloat size, CFStringRef language);
 CTFontDescriptorRef CTFontDescriptorCreateWithTextStyle(CFStringRef style, CFStringRef size, CFStringRef language);
 CTFontDescriptorRef CTFontDescriptorCreateCopyWithSymbolicTraits(CTFontDescriptorRef original, CTFontSymbolicTraits symTraitValue, CTFontSymbolicTraits symTraitMask);

Modified: trunk/Source/WebCore/platform/graphics/coretext/FontCoreText.cpp (282397 => 282398)


--- trunk/Source/WebCore/platform/graphics/coretext/FontCoreText.cpp	2021-09-14 18:38:58 UTC (rev 282397)
+++ trunk/Source/WebCore/platform/graphics/coretext/FontCoreText.cpp	2021-09-14 18:42:12 UTC (rev 282398)
@@ -108,6 +108,9 @@
 
 bool fontHasTable(CTFontRef ctFont, unsigned tableTag)
 {
+#if USE(CTFONTHASTABLE)
+    return CTFontHasTable(ctFont, tableTag);
+#else
     auto tableTags = adoptCF(CTFontCopyAvailableTables(ctFont, kCTFontTableOptionNoOptions));
     if (!tableTags)
         return false;
@@ -118,10 +121,14 @@
             return true;
     }
     return false;
+#endif
 }
 
 bool fontHasEitherTable(CTFontRef ctFont, unsigned tableTag1, unsigned tableTag2)
 {
+#if USE(CTFONTHASTABLE)
+    return fontHasTable(ctFont, tableTag1) || fontHasTable(ctFont, tableTag2);
+#else
     auto tableTags = adoptCF(CTFontCopyAvailableTables(ctFont, kCTFontTableOptionNoOptions));
     if (!tableTags)
         return false;
@@ -132,6 +139,7 @@
             return true;
     }
     return false;
+#endif
 }
 
 void Font::platformInit()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to