Index: Source/platform/fonts/mac/FontCacheMac.mm |
diff --git a/Source/platform/fonts/mac/FontCacheMac.mm b/Source/platform/fonts/mac/FontCacheMac.mm |
index dcb7611a1d41c1de71ae203951ec64849dfcfcdb..8e8eb0e510aac5df2cbccc771fb89a8db29f76e5 100644 |
--- a/Source/platform/fonts/mac/FontCacheMac.mm |
+++ b/Source/platform/fonts/mac/FontCacheMac.mm |
@@ -117,7 +117,7 @@ PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescrip |
} |
const FontPlatformData& platformData = fontDataToSubstitute->platformData(); |
- NSFont *nsFont = platformData.font(); |
+ NSFont* nsFont = const_cast<NSFont*>(reinterpret_cast<const NSFont*>(platformData.ctFont())); |
Robert Sesek
2015/02/24 16:13:07
Can you create something lke toCTFontRef() or leav
Dominik Röttsches
2015/03/19 15:20:00
Added toNSFont to FontPlatformData.h
|
NSString *string = [[NSString alloc] initWithCharactersNoCopy:codeUnits length:codeUnitsLength freeWhenDone:NO]; |
NSFont *substituteFont = [NSFont findFontLike:nsFont forString:string withRange:NSMakeRange(0, codeUnitsLength) inLanguage:nil]; |
@@ -218,11 +218,14 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD |
bool syntheticBold = (isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(actualWeight)) || fontDescription.isSyntheticBold(); |
bool syntheticItalic = ((traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait)) || fontDescription.isSyntheticItalic(); |
- // FontPlatformData::font() can be null for the case of Chromium out-of-process font loading. |
- // In that case, we don't want to use the platformData. |
+ // FontPlatformData::typeface() is null in the case of Chromium out-of-process font loading failing. |
+ // Out-of-process loading occurs for registered fonts stored in non-system locations. |
+ // When loading fails, we do not want to use the returned FontPlatformData since it will not have |
+ // a valid SkTypeface. |
OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platformFont, size, syntheticBold, syntheticItalic, fontDescription.orientation())); |
- if (!platformData->font()) |
- return 0; |
+ if (!platformData->typeface()) { |
+ return nullptr; |
+ } |
return platformData.leakPtr(); |
} |