Title: [202538] trunk/Source/WebCore
- Revision
- 202538
- Author
- [email protected]
- Date
- 2016-06-27 21:04:48 -0700 (Mon, 27 Jun 2016)
Log Message
[macOS] Test gardening: Generic font families should not map to fonts which aren't installed
https://bugs.webkit.org/show_bug.cgi?id=159111
<rdar://problem/25807529>
Unreviewed.
Osaka-Mono does not come preinstalled on macOS Sierra. However, many Japanese users
will have the font installed. Before setting the generic font family, we should check
to see if the font is present.
* page/cocoa/SettingsCocoa.mm:
(WebCore::osakaMonoIsInstalled):
(WebCore::Settings::initializeDefaultFontFamilies):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (202537 => 202538)
--- trunk/Source/WebCore/ChangeLog 2016-06-28 03:25:47 UTC (rev 202537)
+++ trunk/Source/WebCore/ChangeLog 2016-06-28 04:04:48 UTC (rev 202538)
@@ -1,3 +1,19 @@
+2016-06-27 Myles C. Maxfield <[email protected]>
+
+ [macOS] Test gardening: Generic font families should not map to fonts which aren't installed
+ https://bugs.webkit.org/show_bug.cgi?id=159111
+ <rdar://problem/25807529>
+
+ Unreviewed.
+
+ Osaka-Mono does not come preinstalled on macOS Sierra. However, many Japanese users
+ will have the font installed. Before setting the generic font family, we should check
+ to see if the font is present.
+
+ * page/cocoa/SettingsCocoa.mm:
+ (WebCore::osakaMonoIsInstalled):
+ (WebCore::Settings::initializeDefaultFontFamilies):
+
2016-06-24 Ryosuke Niwa <[email protected]>
Don't keep all newly created potential custom elements alive when the feature is disabled
Modified: trunk/Source/WebCore/page/cocoa/SettingsCocoa.mm (202537 => 202538)
--- trunk/Source/WebCore/page/cocoa/SettingsCocoa.mm 2016-06-28 03:25:47 UTC (rev 202537)
+++ trunk/Source/WebCore/page/cocoa/SettingsCocoa.mm 2016-06-28 04:04:48 UTC (rev 202538)
@@ -51,6 +51,18 @@
#if PLATFORM(MAC)
+static bool osakaMonoIsInstalled()
+{
+ int _one_ = 1;
+ RetainPtr<CFNumberRef> yes = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one));
+ CFTypeRef keys[] = { kCTFontEnabledAttribute, kCTFontNameAttribute };
+ CFTypeRef values[] = { yes.get(), CFSTR("Osaka-Mono") };
+ RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(values), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CTFontDescriptorRef> descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
+ RetainPtr<CFSetRef> mandatoryAttributes = adoptCF(CFSetCreate(kCFAllocatorDefault, keys, WTF_ARRAY_LENGTH(keys), &kCFTypeSetCallBacks));
+ return adoptCF(CTFontDescriptorCreateMatchingFontDescriptor(descriptor.get(), mandatoryAttributes.get()));
+}
+
void Settings::initializeDefaultFontFamilies()
{
setStandardFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN);
@@ -64,7 +76,7 @@
setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);
setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
- setFixedFontFamily("Osaka-Mono", USCRIPT_KATAKANA_OR_HIRAGANA);
+ setFixedFontFamily(osakaMonoIsInstalled() ? "Osaka-Mono" : "Hiragino Sans", USCRIPT_KATAKANA_OR_HIRAGANA);
setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes