| Index: Source/platform/fonts/mac/FontCacheMac.mm
|
| diff --git a/Source/platform/fonts/mac/FontCacheMac.mm b/Source/platform/fonts/mac/FontCacheMac.mm
|
| index fae31d6e713ec2db93e883c8ecf0eacded0ef18d..14ac4e6ab7dea82b34f99dc4c7e997bc99e0faf2 100644
|
| --- a/Source/platform/fonts/mac/FontCacheMac.mm
|
| +++ b/Source/platform/fonts/mac/FontCacheMac.mm
|
| @@ -82,6 +82,22 @@ 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;
|
| @@ -187,9 +203,10 @@ 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, fontDescription.weight(), size);
|
| + NSFont *nsFont = MatchNSFontFamily(creationParams.family(),traits, weight, size);
|
| if (!nsFont)
|
| return 0;
|
|
|
| @@ -200,8 +217,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
|
| NSInteger actualWeight = [fontManager weightOfFont:nsFont];
|
|
|
| NSFont *platformFont = useHinting() ? [nsFont screenFont] : [nsFont printerFont];
|
| - NSInteger appKitWeight = toAppKitFontWeight(fontDescription.weight());
|
| - bool syntheticBold = (isAppKitFontWeightBold(appKitWeight) && !isAppKitFontWeightBold(actualWeight)) || fontDescription.isSyntheticBold();
|
| + bool syntheticBold = (isAppKitFontWeightBold(weight) && !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.
|
|
|