| Index: content/common/font_list_mac.mm
|
| diff --git a/content/common/font_list_mac.mm b/content/common/font_list_mac.mm
|
| index 8c7d889b853a9674ecd536dabeb2ac0a672260db..d4768ae25b9fe806b5e13809de7168e7bba8873c 100644
|
| --- a/content/common/font_list_mac.mm
|
| +++ b/content/common/font_list_mac.mm
|
| @@ -16,17 +16,29 @@
|
| base::mac::ScopedNSAutoreleasePool autorelease_pool;
|
| std::unique_ptr<base::ListValue> font_list(new base::ListValue);
|
| NSFontManager* fontManager = [[[NSFontManager alloc] init] autorelease];
|
| + NSMutableDictionary* fonts_dict = [NSMutableDictionary dictionary];
|
| NSArray* fonts = [fontManager availableFontFamilies];
|
| +
|
| for (NSString* family_name in fonts) {
|
| NSString* localized_family_name =
|
| [fontManager localizedNameForFamily:family_name face:nil];
|
| + fonts_dict[family_name] = localized_family_name;
|
| + }
|
| +
|
| + // Sort family names based on localized names.
|
| + NSArray* sortedFonts = [fonts_dict
|
| + keysSortedByValueUsingSelector:@selector(localizedStandardCompare:)];
|
| +
|
| + for (NSString* family_name in sortedFonts) {
|
| + NSString* localized_family_name = fonts_dict[family_name];
|
| base::ListValue* font_item = new base::ListValue();
|
| base::string16 family = base::SysNSStringToUTF16(family_name);
|
| - font_item->Append(new base::StringValue(family));
|
| base::string16 loc_family = base::SysNSStringToUTF16(localized_family_name);
|
| + font_item->Append(new base::StringValue(family));
|
| font_item->Append(new base::StringValue(loc_family));
|
| font_list->Append(font_item);
|
| }
|
| +
|
| return font_list;
|
| }
|
|
|
|
|