Bug 1591432 - avoid creating paths for color fonts on macOS. r=jrmuizel
authorLee Salzman <lsalzman@mozilla.com>
Wed, 06 Nov 2019 21:50:24 +0000
changeset 500979 f3cae791d6703cde2d748a284d05c49d8434927a
parent 500978 f2a5d56c886dd7f31aaebfcf6016539aa1d5d42f
child 500980 1e710184eb57d8decb388aee8efdac082d9b48a1
push id99914
push userlsalzman@mozilla.com
push dateWed, 06 Nov 2019 22:53:55 +0000
treeherderautoland@f3cae791d670 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1591432
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1591432 - avoid creating paths for color fonts on macOS. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D52100
gfx/skia/skia/src/ports/SkFontHost_mac.cpp
--- a/gfx/skia/skia/src/ports/SkFontHost_mac.cpp
+++ b/gfx/skia/skia/src/ports/SkFontHost_mac.cpp
@@ -1275,17 +1275,19 @@ void SkScalerContext_Mac::generateMetric
                                         &cgGlyph, &cgBounds, 1);
         cgBounds = CGRectApplyAffineTransform(cgBounds, fTransform);
 
         // BUG?
         // 0x200B (zero-advance space) seems to return a huge (garbage) bounds, when
         // it should be empty. So, if we see a zero-advance, we check if it has an
         // empty path or not, and if so, we jam the bounds to 0. Hopefully a zero-advance
         // is rare, so we won't incur a big performance cost for this extra check.
-        if (0 == cgAdvance.width && 0 == cgAdvance.height) {
+        // Avoid trying to create a path from a color font due to crashing on 10.9.
+        if (0 == cgAdvance.width && 0 == cgAdvance.height &&
+            SkMask::kARGB32_Format != glyph->fMaskFormat) {
             SkUniqueCFRef<CGPathRef> path(CTFontCreatePathForGlyph(fCTFont.get(), cgGlyph,nullptr));
             if (!path || CGPathIsEmpty(path.get())) {
                 return;
             }
         }
 
         if (CGRectIsEmpty_inline(cgBounds)) {
             return;