Changeset 202538 in webkit


Ignore:
Timestamp:
Jun 27, 2016 9:04:48 PM (8 years ago)
Author:
mmaxfield@apple.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202537 r202538  
     12016-06-27  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [macOS] Test gardening: 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        Unreviewed.
     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-24  Ryosuke Niwa  <rniwa@webkit.org>
    218
  • trunk/Source/WebCore/page/cocoa/SettingsCocoa.mm

    r200534 r202538  
    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{
     
    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);
Note: See TracChangeset for help on using the changeset viewer.