Index: Source/platform/fonts/mac/FontCacheMac.mm |
diff --git a/Source/platform/fonts/mac/FontCacheMac.mm b/Source/platform/fonts/mac/FontCacheMac.mm |
index 14ac4e6ab7dea82b34f99dc4c7e997bc99e0faf2..fae31d6e713ec2db93e883c8ecf0eacded0ef18d 100644 |
--- a/Source/platform/fonts/mac/FontCacheMac.mm |
+++ b/Source/platform/fonts/mac/FontCacheMac.mm |
@@ -82,22 +82,6 @@ void FontCache::platformInit() |
CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, fontCacheRegisteredFontsChangedNotificationCallback, kCTFontManagerRegisteredFontsChangedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately); |
} |
-static int toAppKitFontWeight(FontWeight fontWeight) |
-{ |
- static int appKitFontWeights[] = { |
- 2, // FontWeight100 |
- 3, // FontWeight200 |
- 4, // FontWeight300 |
- 5, // FontWeight400 |
- 6, // FontWeight500 |
- 8, // FontWeight600 |
- 9, // FontWeight700 |
- 10, // FontWeight800 |
- 12, // FontWeight900 |
- }; |
- return appKitFontWeights[fontWeight]; |
-} |
- |
static inline bool isAppKitFontWeightBold(NSInteger appKitFontWeight) |
{ |
return appKitFontWeight >= 7; |
@@ -203,10 +187,9 @@ PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescri |
FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, float fontSize) |
{ |
NSFontTraitMask traits = fontDescription.style() ? NSFontItalicTrait : 0; |
- NSInteger weight = toAppKitFontWeight(fontDescription.weight()); |
float size = fontSize; |
- NSFont *nsFont = MatchNSFontFamily(creationParams.family(),traits, weight, size); |
+ NSFont* nsFont = MatchNSFontFamily(creationParams.family(), traits, fontDescription.weight(), size); |
if (!nsFont) |
return 0; |
@@ -217,7 +200,8 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD |
NSInteger actualWeight = [fontManager weightOfFont:nsFont]; |
NSFont *platformFont = useHinting() ? [nsFont screenFont] : [nsFont printerFont]; |
- bool syntheticBold = (isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(actualWeight)) || fontDescription.isSyntheticBold(); |
+ NSInteger appKitWeight = toAppKitFontWeight(fontDescription.weight()); |
+ bool syntheticBold = (isAppKitFontWeightBold(appKitWeight) && !isAppKitFontWeightBold(actualWeight)) || fontDescription.isSyntheticBold(); |
bool syntheticItalic = ((traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait)) || fontDescription.isSyntheticItalic(); |
// FontPlatformData::typeface() is null in the case of Chromium out-of-process font loading failing. |