Source/WebCore/ChangeLog

 12016-06-27 Myles C. Maxfield <mmaxfield@apple.com>
 2
 3 [macOS] Generic font families should not map to fonts which aren't installed
 4 https://bugs.webkit.org/show_bug.cgi?id=159111
 5 <rdar://problem/25807529>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 Osaka-Mono does not come preinstalled on macOS Sierra. However, many Japanese users
 10 will have the font installed. Before setting the generic font family, we should check
 11 to see if the font is present.
 12
 13 * page/cocoa/SettingsCocoa.mm:
 14 (WebCore::osakaMonoIsInstalled):
 15 (WebCore::Settings::initializeDefaultFontFamilies):
 16
1172016-06-27 Commit Queue <commit-queue@webkit.org>
218
319 Unreviewed, rolling out r202520.

Source/WebCore/page/cocoa/SettingsCocoa.mm

@@static inline const char* sansSerifSimplifiedHanFontFamily()
5151
5252#if PLATFORM(MAC)
5353
 54static bool osakaMonoIsInstalled()
 55{
 56 int one = 1;
 57 RetainPtr<CFNumberRef> yes = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one));
 58 CFTypeRef keys[] = { kCTFontEnabledAttribute, kCTFontNameAttribute };
 59 CFTypeRef values[] = { yes.get(), CFSTR("Osaka-Mono") };
 60 RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(values), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 61 RetainPtr<CTFontDescriptorRef> descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
 62 Retainptr<CFSetRef> mandatoryAttributes = adoptCF(CFSetCreate(kCFAllocatorDefault, keys, WTF_ARRAY_LENGTH(keys), &kCFTypeSetCallBacks));
 63 return adoptCF(CTFontDescriptorCreateMatchingFontDescriptor(descriptor.get(), mandatoryAttributes.get()));
 64}
 65
5466void Settings::initializeDefaultFontFamilies()
5567{
5668 setStandardFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN);

@@void Settings::initializeDefaultFontFamilies()
6476 setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
6577
6678 setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
67  setFixedFontFamily("Osaka-Mono", USCRIPT_KATAKANA_OR_HIRAGANA);
 79 setFixedFontFamily(osakaMonoIsInstalled() ? "Osaka-Mono" : "Hiragino Sans", USCRIPT_KATAKANA_OR_HIRAGANA);
6880 setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
6981 setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
7082