Index: chrome/browser/ui/webui/options/font_settings_utils_mac.mm |
diff --git a/chrome/browser/ui/webui/options/font_settings_utils_mac.mm b/chrome/browser/ui/webui/options/font_settings_utils_mac.mm |
index a7079bb21fa64f4290aed61183f8ef3a88acabc5..b31d4ba6e9316db64ba55b2335b4e7d7f2a3eaf8 100644 |
--- a/chrome/browser/ui/webui/options/font_settings_utils_mac.mm |
+++ b/chrome/browser/ui/webui/options/font_settings_utils_mac.mm |
@@ -19,14 +19,21 @@ static void ValidateFontFamily(PrefService* prefs, |
// -[NSFont fontWithName:size] accepted a font or family name, but the |
// behavior was technically wrong. Since we really need the family name for |
// the dom-ui options window, we will fix the saved preference if necessary. |
- NSString *family_name = |
+ NSString *pref_value = |
base::SysUTF8ToNSString(prefs->GetString(family_pref_name)); |
- NSFont *font = [NSFont fontWithName:family_name |
+ NSFont *font = [NSFont fontWithName:pref_value |
size:[NSFont systemFontSize]]; |
+ NSString* familyName = [font familyName]; |
brettw
2011/06/24 20:56:26
Local variables should be lower_case_with_undersco
|
+ NSFontManager* fontManager = [[[NSFontManager alloc] init] autorelease]; |
csilv
2011/06/24 20:51:30
Use scoped_nsobject instead of autorelease.
|
if (font && |
- [[font familyName] caseInsensitiveCompare:family_name] != NSOrderedSame) { |
- std::string new_family_name = base::SysNSStringToUTF8([font familyName]); |
- prefs->SetString(family_pref_name, new_family_name); |
+ [familyName caseInsensitiveCompare:pref_value] != NSOrderedSame && |
+ // The condition below is for Osaka-Mono which exceptionally stores font |
brettw
2011/06/24 20:56:26
I'd probably not put the comment in the middle of
|
+ // name instead of font family name. See GetFontList_SlowBlocking |
+ // in font_list_mac.mm for more info. |
+ [fontManager fontNamed:familyName hasTraits:NSFixedPitchFontMask] == |
+ [fontManager fontNamed:pref_value hasTraits:NSFixedPitchFontMask]) { |
+ std::string new_pref_value = base::SysNSStringToUTF8(familyName); |
+ prefs->SetString(family_pref_name, new_pref_value); |
} |
} |