Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1341)

Unified Diff: Source/platform/fonts/mac/FontCacheMac.mm

Issue 879533003: Remove Mac native font type members from FontPlatformData (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Memory management review comments addressed Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/platform/fonts/mac/FontCacheMac.mm
diff --git a/Source/platform/fonts/mac/FontCacheMac.mm b/Source/platform/fonts/mac/FontCacheMac.mm
index 0b54574eb1041d324b4bb2c221a4fb37e30a6be1..31da55793c4b54620e504d280bf63fa90126677f 100644
--- a/Source/platform/fonts/mac/FontCacheMac.mm
+++ b/Source/platform/fonts/mac/FontCacheMac.mm
@@ -119,7 +119,7 @@ PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescrip
}
const FontPlatformData& platformData = fontDataToSubstitute->platformData();
- NSFont *nsFont = platformData.font();
+ NSFont* nsFont = toNSFont(platformData.ctFont());
NSString *string = [[NSString alloc] initWithCharactersNoCopy:codeUnits length:codeUnitsLength freeWhenDone:NO];
NSFont *substituteFont = [NSFont findFontLike:nsFont forString:string withRange:NSMakeRange(0, codeUnitsLength) inLanguage:nil];
@@ -220,11 +220,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();
}

Powered by Google App Engine
This is Rietveld 408576698