Title: [266666] trunk/Source
Revision
266666
Author
[email protected]
Date
2020-09-05 11:07:19 -0700 (Sat, 05 Sep 2020)

Log Message

[Cocoa] Migrate off SPI in Font::platformWidthForGlyph()
https://bugs.webkit.org/show_bug.cgi?id=215670

Reviewed by Zalan Bujtas.

Source/WebCore:

All the tests pass, and the microbenchmark attached to <rdar://problem/21026016> says it isn't a regression.

* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::platformWidthForGlyph const):

Source/WTF:

* wtf/PlatformUse.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (266665 => 266666)


--- trunk/Source/WTF/ChangeLog	2020-09-05 17:57:00 UTC (rev 266665)
+++ trunk/Source/WTF/ChangeLog	2020-09-05 18:07:19 UTC (rev 266666)
@@ -1,3 +1,12 @@
+2020-09-05  Myles C. Maxfield  <[email protected]>
+
+        [Cocoa] Migrate off SPI in Font::platformWidthForGlyph()
+        https://bugs.webkit.org/show_bug.cgi?id=215670
+
+        Reviewed by Zalan Bujtas.
+
+        * wtf/PlatformUse.h:
+
 2020-09-04  Alex Christensen  <[email protected]>
 
         Move PDF heads-up display to UI process on macOS

Modified: trunk/Source/WTF/wtf/PlatformUse.h (266665 => 266666)


--- trunk/Source/WTF/wtf/PlatformUse.h	2020-09-05 17:57:00 UTC (rev 266665)
+++ trunk/Source/WTF/wtf/PlatformUse.h	2020-09-05 18:07:19 UTC (rev 266666)
@@ -304,3 +304,7 @@
 #if PLATFORM(COCOA) && !(PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 110000)
 #define USE_CTFONTSHAPEGLYPHS 1
 #endif
+
+#if PLATFORM(COCOA) && (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 110000)
+#define USE_CTFONTGETADVANCES_WORKAROUND 1
+#endif

Modified: trunk/Source/WebCore/ChangeLog (266665 => 266666)


--- trunk/Source/WebCore/ChangeLog	2020-09-05 17:57:00 UTC (rev 266665)
+++ trunk/Source/WebCore/ChangeLog	2020-09-05 18:07:19 UTC (rev 266666)
@@ -1,5 +1,17 @@
 2020-09-05  Myles C. Maxfield  <[email protected]>
 
+        [Cocoa] Migrate off SPI in Font::platformWidthForGlyph()
+        https://bugs.webkit.org/show_bug.cgi?id=215670
+
+        Reviewed by Zalan Bujtas.
+
+        All the tests pass, and the microbenchmark attached to <rdar://problem/21026016> says it isn't a regression.
+
+        * platform/graphics/cocoa/FontCocoa.mm:
+        (WebCore::Font::platformWidthForGlyph const):
+
+2020-09-05  Myles C. Maxfield  <[email protected]>
+
         [macOS] Don't apply synthetic bold or italics to emoji
         https://bugs.webkit.org/show_bug.cgi?id=215686
 

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (266665 => 266666)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2020-09-05 17:57:00 UTC (rev 266665)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm	2020-09-05 18:07:19 UTC (rev 266666)
@@ -670,16 +670,19 @@
 float Font::platformWidthForGlyph(Glyph glyph) const
 {
     CGSize advance = CGSizeZero;
-    bool horizontal = platformData().orientation() == FontOrientation::Horizontal;
-    CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered;
 
     if (platformData().size()) {
+        bool horizontal = platformData().orientation() == FontOrientation::Horizontal;
         CTFontOrientation orientation = horizontal || m_isBrokenIdeographFallback ? kCTFontOrientationHorizontal : kCTFontOrientationVertical;
-        // FIXME: Remove this special-casing when <rdar://problem/28197291> and <rdar://problem/28662086> are fixed.
-        if (CTFontIsAppleColorEmoji(m_platformData.ctFont()) || m_platformData.hasVariations())
+#if USE(CTFONTGETADVANCES_WORKAROUND)
+        CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered;
+        if (!CTFontIsAppleColorEmoji(m_platformData.ctFont()) && !m_platformData.hasVariations())
+            CTFontGetUnsummedAdvancesForGlyphsAndStyle(m_platformData.ctFont(), orientation, style, &glyph, &advance, 1);
+        else
+#endif
+        {
             CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), orientation, &glyph, &advance, 1);
-        else
-            CTFontGetUnsummedAdvancesForGlyphsAndStyle(m_platformData.ctFont(), orientation, style, &glyph, &advance, 1);
+        }
     }
     return advance.width + m_syntheticBoldOffset;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to