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

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

Issue 1292593003: Revert "Revert "Reland 2: mac: Use a placeholder string for the family name of the system font." Br… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/fonts/mac/FontFamilyMatcherMac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/fonts/mac/FontFamilyMatcherMac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698