| 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 6dae847e2fbeb58d7cf66ddc2a28915be2219be0..3817dc45e0a593b613302c7179e5975945bac2aa 100644
|
| --- a/chrome/browser/ui/webui/options/font_settings_utils_mac.mm
|
| +++ b/chrome/browser/ui/webui/options/font_settings_utils_mac.mm
|
| @@ -7,6 +7,7 @@
|
| #import <Cocoa/Cocoa.h>
|
|
|
| #include "base/mac/scoped_nsautorelease_pool.h"
|
| +#include "base/mac/scoped_nsobject.h"
|
| #include "base/prefs/pref_service.h"
|
| #include "base/strings/sys_string_conversions.h"
|
| #include "base/values.h"
|
| @@ -21,14 +22,22 @@ 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* family_name = [font familyName];
|
| + base::scoped_nsobject<NSFontManager> font_manager(
|
| + [[NSFontManager alloc] init]);
|
| + // The fixed pitch check is for Osaka-Mono which exceptionally stores font
|
| + // name instead of font family name. See GetFontList_SlowBlocking
|
| + // in font_list_mac.mm for more info.
|
| 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);
|
| + [family_name caseInsensitiveCompare:pref_value] != NSOrderedSame &&
|
| + [font_manager fontNamed:family_name hasTraits:NSFixedPitchFontMask] ==
|
| + [font_manager fontNamed:pref_value hasTraits:NSFixedPitchFontMask]) {
|
| + std::string new_pref_value = base::SysNSStringToUTF8(family_name);
|
| + prefs->SetString(family_pref_name, new_pref_value);
|
| }
|
| }
|
|
|
|
|