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

Unified Diff: chrome/browser/ui/webui/options/font_settings_utils_mac.mm

Issue 7204026: Changed fontlist to list all avalilable fonts. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Just adds Osaka Created 9 years, 6 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 | « no previous file | content/common/font_list_mac.mm » ('j') | content/common/font_list_mac.mm » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « no previous file | content/common/font_list_mac.mm » ('j') | content/common/font_list_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698