Changeset 241288 in webkit
- Timestamp:
- Feb 11, 2019 6:19:19 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r241286 r241288 1 2019-02-11 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Cocoa] Ask platform for generic font family mappings 4 https://bugs.webkit.org/show_bug.cgi?id=187723 5 <rdar://problem/41892438> 6 7 Reviewed by Brent Fulgham. 8 9 Update the tests to work with this new model. 10 11 * fast/text/international/font-fallback-to-common-script-expected.html: Removed. 12 * fast/text/international/font-fallback-to-common-script.html: Removed. 13 * fast/text/international/lang-sensitive-fonts-expected.html: 14 * fast/text/international/lang-sensitive-fonts-xml-expected.html: 15 * fast/text/international/lang-sensitive-fonts-xml.xhtml: 16 * fast/text/international/lang-sensitive-fonts.html: 17 * fast/text/international/locale-sensitive-fonts-expected.html: 18 * fast/text/international/locale-sensitive-fonts.html: 19 * fast/text/ja-sans-serif-expected-mismatch.html: Added. 20 * fast/text/ja-sans-serif.html: Added. 21 * platform/ios/fast/block/float/016-expected.txt: 22 1 23 2019-02-11 Shawn Roberts <sroberts@apple.com> 2 24 -
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-expected.html
r241268 r241288 2 2 <body> 3 3 <div style="font-size: 20px"> 4 <div style="font-family: 'Ahem'">this is ahem font</div>5 4 <div style="font-family: 'Ahem'">this is ahem font</div> 6 5 <div style="font-family: 'Ahem'">this is ahem font</div> -
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-xml-expected.html
r241268 r241288 6 6 <div>this is ahem font</div> 7 7 <div>this is ahem font</div> 8 <div>this is ahem font</div>9 8 </div> 10 9 </body> -
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-xml.xhtml
r241268 r241288 22 22 <div lang="zh-CN">this is ahem font</div> 23 23 <div id="target1" lang="ar">this is ahem font</div> 24 <div id="target2" lang="ar" style="font-family: sans-serif">this is ahem font</div>25 24 <div xml:lang="zh-CN">this is ahem font</div> 26 25 </div> 27 26 <script> 28 27 document.getElementById("target1").lang = "zh-CN"; 29 30 document.getElementById("target2").lang = "zh-CN";31 document.getElementById("target2").style.fontFamily = "fantasy";32 28 </script> 33 29 </body> -
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts.html
r241268 r241288 21 21 <div lang="zh-CN">this is ahem font</div> 22 22 <div id="target1" lang="ar">this is ahem font</div> 23 <div id="target2" lang="ar" style="font-family: sans-serif">this is ahem font</div>24 23 <div xml:lang="zh-CN">this is not ahem font</div> 25 24 </div> 26 25 <script> 27 26 document.getElementById("target1").lang = "zh-CN"; 28 29 document.getElementById("target2").lang = "zh-CN";30 document.getElementById("target2").style.fontFamily = "fantasy";31 27 </script> 32 28 </body> -
trunk/LayoutTests/fast/text/international/locale-sensitive-fonts-expected.html
r241268 r241288 7 7 <div style="font-family: 'Ahem'">this is ahem font</div> 8 8 <div style="font-family: 'Ahem'">this is ahem font</div> 9 <div style="font-family: 'Ahem'">this is ahem font</div>10 9 </div> 11 10 </body> -
trunk/LayoutTests/fast/text/international/locale-sensitive-fonts.html
r241268 r241288 17 17 <div style="font-family: 'Ahem'">this is ahem font</div> 18 18 <div style="-webkit-locale: 'zh_CN'">this is ahem font</div> 19 <div style="-webkit-locale: 'zh_CN'; font-family: fantasy">this is ahem font</div>20 19 </div> 21 20 </body> -
trunk/LayoutTests/platform/ios/fast/block/float/016-expected.txt
r241268 r241288 1 1 layer at (0,0) size 800x600 2 2 RenderView at (0,0) size 800x600 3 layer at (0,0) size 800x51 14 RenderBlock {HTML} at (0,0) size 800x51 25 RenderBody {BODY} at (8,8) size 784x48 83 layer at (0,0) size 800x512 4 RenderBlock {HTML} at (0,0) size 800x513 5 RenderBody {BODY} at (8,8) size 784x489 6 6 RenderBlock {UL} at (185,0) size 414x192 7 7 RenderListItem {LI} at (0,48) size 284x72 … … 63 63 RenderText {#text} at (59,0) size 26x20 64 64 text run at (59,0) width 26: "exit" 65 RenderBlock {P} at (0,403) size 784x8 566 RenderText {#text} at (3 27,32) size 130x1967 text run at (3 27,32) width 130: "Ceci n'est pas Flash."65 RenderBlock {P} at (0,403) size 784x86 66 RenderText {#text} at (331,32) size 122x21 67 text run at (331,32) width 122: "Ceci n'est pas Flash." -
trunk/Source/WTF/ChangeLog
r241268 r241288 1 2019-02-11 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Cocoa] Ask platform for generic font family mappings 4 https://bugs.webkit.org/show_bug.cgi?id=187723 5 <rdar://problem/41892438> 6 7 Reviewed by Brent Fulgham. 8 9 Add an ENABLE in Platform. 10 11 * wtf/Platform.h: 12 1 13 2019-02-11 Truitt Savell <tsavell@apple.com> 2 14 -
trunk/Source/WTF/wtf/Platform.h
r241268 r241288 1499 1499 #define HAVE_CSCHECKFIXDISABLE 1 1500 1500 #endif 1501 1502 #if PLATFORM(MAC) 1503 #define ENABLE_MONOSPACE_FONT_EXCEPTION (__MAC_OS_X_VERSION_MIN_REQUIRED < 101500) 1504 #elif PLATFORM(IOS_FAMILY) 1505 #define ENABLE_MONOSPACE_FONT_EXCEPTION (__IPHONE_OS_VERSION_MIN_REQUIRED < 130000) 1506 #endif -
trunk/Source/WebCore/ChangeLog
r241283 r241288 1 2019-02-11 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Cocoa] Ask platform for generic font family mappings 4 https://bugs.webkit.org/show_bug.cgi?id=187723 5 <rdar://problem/41892438> 6 7 Reviewed by Brent Fulgham. 8 9 WebKit API allows setting the generic font families for the USCRIPT_COMMON script. 10 When trying to style a character with a generic font family, we first look to see if 11 we have a mapping for the particular script the character is rendered with, and if we 12 don't find a match, we then check USCRIPT_COMMON. 13 14 In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka 15 the only scripts which won't use the API families) is in 16 SettingsBase::initializeDefaultFontFamilies(). That function only sets the families 17 for the CJK scripts. 18 19 The mappings inside SettingsBase are incorrect and conflict with our policy regarding 20 user-installed fonts. Instead, we should be consulting with the platform for some of 21 these mappings, by calling CTFontDescriptorCreateForCSSFamily(). However, the WebKit 22 API still has to work to set the mappings for untagged content. Therefore, we use the 23 system mappings for language-tagged content, and the API mappings for non-language-tagged 24 content. This is a good balance that makes sure we always have a good mapping for every 25 language, but API clients can still set the mappings, too. 26 27 Test: fast/text/ja-sans-serif.html 28 29 * css/CSSComputedStyleDeclaration.cpp: 30 * css/CSSFontSelector.cpp: 31 (WebCore::resolveGenericFamily): 32 * css/parser/CSSPropertyParser.cpp: 33 (WebCore::consumeFontFamily): 34 * page/cocoa/SettingsBaseCocoa.mm: 35 (WebCore::SettingsBase::initializeDefaultFontFamilies): 36 (WebCore::osakaMonoIsInstalled): Deleted. 37 * platform/graphics/FontDescription.cpp: 38 (WebCore::FontDescription::platformResolveGenericFamily): 39 * platform/graphics/FontDescription.h: 40 * platform/graphics/cocoa/FontDescriptionCocoa.cpp: 41 (WebCore::computeSpecializedChineseLocale): 42 (WebCore::cachedSpecializedChineseLocale): 43 (WebCore::languageChanged): 44 (WebCore::FontDescription::platformResolveGenericFamily): 45 * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: 46 (WebCore::SystemFontDatabaseCoreText::clear): 47 (WebCore::genericFamily): 48 (WebCore::SystemFontDatabaseCoreText::serifFamily): 49 (WebCore::SystemFontDatabaseCoreText::sansSerifFamily): 50 (WebCore::SystemFontDatabaseCoreText::cursiveFamily): 51 (WebCore::SystemFontDatabaseCoreText::fantasyFamily): 52 (WebCore::SystemFontDatabaseCoreText::monospaceFamily): 53 * platform/graphics/cocoa/SystemFontDatabaseCoreText.h: 54 1 55 2019-02-11 Adrian Perez de Castro <aperez@igalia.com> 2 56 -
trunk/Source/WebCore/PAL/ChangeLog
r241281 r241288 1 2019-02-11 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Cocoa] Ask platform for generic font family mappings 4 https://bugs.webkit.org/show_bug.cgi?id=187723 5 <rdar://problem/41892438> 6 7 Reviewed by Brent Fulgham. 8 9 * pal/spi/cocoa/CoreTextSPI.h: 10 1 11 2019-02-11 Jer Noble <jer.noble@apple.com> 2 12 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
r241268 r241288 80 80 extern const CFStringRef kCTFontFallbackOptionAttribute; 81 81 82 extern const CFStringRef kCTFontCSSFamilySerif; 83 extern const CFStringRef kCTFontCSSFamilySansSerif; 84 extern const CFStringRef kCTFontCSSFamilyCursive; 85 extern const CFStringRef kCTFontCSSFamilyFantasy; 86 extern const CFStringRef kCTFontCSSFamilyMonospace; 87 extern const CFStringRef kCTFontCSSFamilySystemUI; 88 82 89 bool CTFontTransformGlyphs(CTFontRef, CGGlyph glyphs[], CGSize advances[], CFIndex count, CTFontTransformOptions); 83 90 … … 88 95 bool CTFontGetVerticalGlyphsForCharacters(CTFontRef, const UniChar characters[], CGGlyph glyphs[], CFIndex count); 89 96 void CTFontGetUnsummedAdvancesForGlyphsAndStyle(CTFontRef, CTFontOrientation, CGFontRenderingStyle, const CGGlyph[], CGSize advances[], CFIndex count); 97 CTFontDescriptorRef CTFontDescriptorCreateForCSSFamily(CFStringRef cssFamily, CFStringRef language); 90 98 91 99 CTFontDescriptorRef CTFontDescriptorCreateForUIType(CTFontUIFontType, CGFloat size, CFStringRef language); -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r241268 r241288 1721 1721 } 1722 1722 1723 1724 1723 static CSSValueID identifierForFamily(const AtomicString& family) 1725 1724 { -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r241268 r241288 275 275 } 276 276 277 static const AtomicString& resolveGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName) 278 { 277 static AtomicString resolveGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName) 278 { 279 auto platformResult = FontDescription::platformResolveGenericFamily(fontDescription.script(), fontDescription.locale(), familyName); 280 if (!platformResult.isNull()) 281 return platformResult; 282 279 283 if (!document) 280 284 return familyName; -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r241268 r241288 1068 1068 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 1069 1069 do { 1070 RefPtr<CSSValue> parsedValue = consumeGenericFamily(range); 1071 if (parsedValue) { 1070 if (auto parsedValue = consumeGenericFamily(range)) 1072 1071 list->append(parsedValue.releaseNonNull()); 1073 } else { 1074 parsedValue = consumeFamilyName(range); 1075 if (parsedValue) { 1072 else { 1073 if (auto parsedValue = consumeFamilyName(range)) 1076 1074 list->append(parsedValue.releaseNonNull()); 1077 } else {1075 else 1078 1076 return nullptr; 1079 }1080 1077 } 1081 1078 } while (consumeCommaIncludingWhitespace(range)); -
trunk/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm
r241268 r241288 49 49 #if PLATFORM(MAC) 50 50 51 static bool osakaMonoIsInstalled()52 {53 int one = 1;54 RetainPtr<CFNumberRef> yes = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one));55 CFTypeRef keys[] = { kCTFontEnabledAttribute, kCTFontNameAttribute };56 CFTypeRef values[] = { yes.get(), CFSTR("Osaka-Mono") };57 RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(values), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));58 RetainPtr<CTFontDescriptorRef> descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));59 RetainPtr<CFSetRef> mandatoryAttributes = adoptCF(CFSetCreate(kCFAllocatorDefault, keys, WTF_ARRAY_LENGTH(keys), &kCFTypeSetCallBacks));60 return adoptCF(CTFontDescriptorCreateMatchingFontDescriptor(descriptor.get(), mandatoryAttributes.get()));61 }62 63 51 void SettingsBase::initializeDefaultFontFamilies() 64 52 { 65 53 setStandardFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN); 66 setSerifFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN);67 setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);68 setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);69 setCursiveFontFamily("Kaiti TC", USCRIPT_TRADITIONAL_HAN);70 71 54 setStandardFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN); 72 setSerifFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN);73 setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);74 setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);75 setCursiveFontFamily("Kaiti SC", USCRIPT_SIMPLIFIED_HAN);76 77 55 setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA); 78 setFixedFontFamily(osakaMonoIsInstalled() ? "Osaka-Mono" : "Hiragino Sans", USCRIPT_KATAKANA_OR_HIRAGANA);79 setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);80 setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);81 82 56 setStandardFontFamily("AppleMyungjo", USCRIPT_HANGUL); 83 setSerifFontFamily("AppleMyungjo", USCRIPT_HANGUL);84 setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);85 setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);86 57 87 58 setStandardFontFamily("Times", USCRIPT_COMMON); … … 100 71 void SettingsBase::initializeDefaultFontFamilies() 101 72 { 102 // There is no serif Chinese font in default iOS installation.103 73 setStandardFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN); 104 setSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);105 setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);106 setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN);107 108 // There is no serif Chinese font in default iOS installation.109 74 setStandardFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN); 110 setSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);111 setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);112 setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN);113 114 75 setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA); 115 setFixedFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);116 setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA);117 setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA);118 119 // There is no serif Korean font in default iOS installation.120 76 setStandardFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); 121 setSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);122 setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);123 setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL);124 77 125 78 setStandardFontFamily("Times", USCRIPT_COMMON); -
trunk/Source/WebCore/platform/graphics/FontDescription.cpp
r241268 r241288 72 72 } 73 73 74 #if !PLATFORM(COCOA) 75 AtomicString FontDescription::platformResolveGenericFamily(UScriptCode, const AtomicString&, const AtomicString&) 76 { 77 return nullAtom(); 78 } 79 #endif 80 74 81 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/FontDescription.h
r241268 r241288 134 134 void setShouldAllowUserInstalledFonts(AllowUserInstalledFonts shouldAllowUserInstalledFonts) { m_shouldAllowUserInstalledFonts = static_cast<unsigned>(shouldAllowUserInstalledFonts); } 135 135 136 static AtomicString platformResolveGenericFamily(UScriptCode, const AtomicString& locale, const AtomicString& familyName); 137 136 138 private: 137 139 // FIXME: Investigate moving these into their own object on the heap (to save memory). -
trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp
r241268 r241288 28 28 29 29 #include "SystemFontDatabaseCoreText.h" 30 #include <mutex> 31 #include <wtf/Language.h> 32 33 namespace WebCore { 30 34 31 35 #if USE_PLATFORM_SYSTEM_FALLBACK_LIST 32 33 namespace WebCore {34 36 35 37 static inline bool isSystemFontString(const AtomicString& string) … … 139 141 } 140 142 143 #endif // USE_PLATFORM_SYSTEM_FALLBACK_LIST 144 145 static String computeSpecializedChineseLocale() 146 { 147 const Vector<String>& preferredLanguages = userPreferredLanguages(); 148 for (auto& language : preferredLanguages) { 149 if (equalIgnoringASCIICase(language, "zh") || startsWithLettersIgnoringASCIICase(language, "zh-")) 150 return language; 151 } 152 return "zh-hans"_str; // We have no signal. Pick one option arbitrarily. 141 153 } 142 154 143 #endif 155 static String& cachedSpecializedChineseLocale() 156 { 157 static NeverDestroyed<String> specializedChineseLocale; 158 return specializedChineseLocale.get(); 159 } 144 160 161 static void languageChanged(void*) 162 { 163 cachedSpecializedChineseLocale() = computeSpecializedChineseLocale(); 164 } 165 166 AtomicString FontDescription::platformResolveGenericFamily(UScriptCode script, const AtomicString& locale, const AtomicString& familyName) 167 { 168 if (script == USCRIPT_COMMON) 169 return nullAtom(); 170 171 static std::once_flag onceFlag; 172 std::call_once(onceFlag, [&] { 173 static char dummy; 174 addLanguageChangeObserver(&dummy, &languageChanged); // We will never remove the observer, so all we need is a non-null pointer. 175 languageChanged(nullptr); 176 }); 177 178 // FIXME: Delete this once <rdar://problem/47682577> is fixed. 179 auto& usedLocale = script == USCRIPT_HAN ? cachedSpecializedChineseLocale() : locale.string(); 180 181 // FIXME: Use the system font database to handle standardFamily 182 if (familyName == serifFamily) 183 return SystemFontDatabaseCoreText::singleton().serifFamily(usedLocale); 184 if (familyName == sansSerifFamily) 185 return SystemFontDatabaseCoreText::singleton().sansSerifFamily(usedLocale); 186 if (familyName == cursiveFamily) 187 return SystemFontDatabaseCoreText::singleton().cursiveFamily(usedLocale); 188 if (familyName == fantasyFamily) 189 return SystemFontDatabaseCoreText::singleton().fantasyFamily(usedLocale); 190 if (familyName == monospaceFamily) 191 return SystemFontDatabaseCoreText::singleton().monospaceFamily(usedLocale); 192 193 return nullAtom(); 194 } 195 196 } 197 -
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
r241268 r241288 27 27 #include "SystemFontDatabaseCoreText.h" 28 28 29 #if USE_PLATFORM_SYSTEM_FALLBACK_LIST30 31 29 #include "FontCache.h" 32 30 #include "FontCascadeDescription.h" … … 47 45 { 48 46 } 47 48 #if USE_PLATFORM_SYSTEM_FALLBACK_LIST 49 49 50 50 Vector<RetainPtr<CTFontDescriptorRef>> SystemFontDatabaseCoreText::cascadeList(const CascadeListParameters& parameters, ClientUse clientUse) … … 81 81 { 82 82 m_systemFontCache.clear(); 83 m_serifFamilies.clear(); 84 m_sansSeriferifFamilies.clear(); 85 m_cursiveFamilies.clear(); 86 m_fantasyFamilies.clear(); 87 m_monospaceFamilies.clear(); 83 88 } 84 89 … … 173 178 } 174 179 175 } 176 180 #endif // USE_PLATFORM_SYSTEM_FALLBACK_LIST 181 182 static String genericFamily(const String& locale, HashMap<String, String>& map, CFStringRef ctKey) 183 { 184 return map.ensure(locale, [&] { 185 auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(ctKey, locale.createCFString().get())); 186 return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); 187 }).iterator->value; 188 } 189 190 String SystemFontDatabaseCoreText::serifFamily(const String& locale) 191 { 192 return genericFamily(locale, m_serifFamilies, kCTFontCSSFamilySerif); 193 } 194 195 String SystemFontDatabaseCoreText::sansSerifFamily(const String& locale) 196 { 197 return genericFamily(locale, m_sansSeriferifFamilies, kCTFontCSSFamilySansSerif); 198 } 199 200 String SystemFontDatabaseCoreText::cursiveFamily(const String& locale) 201 { 202 return genericFamily(locale, m_cursiveFamilies, kCTFontCSSFamilyCursive); 203 } 204 205 String SystemFontDatabaseCoreText::fantasyFamily(const String& locale) 206 { 207 return genericFamily(locale, m_fantasyFamilies, kCTFontCSSFamilyFantasy); 208 } 209 210 String SystemFontDatabaseCoreText::monospaceFamily(const String& locale) 211 { 212 auto result = genericFamily(locale, m_monospaceFamilies, kCTFontCSSFamilyMonospace); 213 #if PLATFORM(MAC) && ENABLE(MONOSPACE_FONT_EXCEPTION) 214 // In general, CoreText uses Monaco for monospaced (see: Terminal.app and Xcode.app). 215 // For now, we want to use Courier for web compatibility, until we have more time to do compatibility testing. 216 if (equalLettersIgnoringASCIICase(result, "monaco")) 217 return "Courier"_str; 218 #elif PLATFORM(IOS_FAMILY) && ENABLE(MONOSPACE_FONT_EXCEPTION) 219 if (equalLettersIgnoringASCIICase(result, "courier new")) 220 return "Courier"_str; 177 221 #endif 222 return result; 223 } 224 225 } -
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h
r241268 r241288 32 32 #include <wtf/text/AtomicString.h> 33 33 #include <wtf/text/AtomicStringHash.h> 34 35 #if USE_PLATFORM_SYSTEM_FALLBACK_LIST36 34 37 35 namespace WebCore { … … 102 100 103 101 Vector<RetainPtr<CTFontDescriptorRef>> cascadeList(const FontCascadeDescription&, const AtomicString& cssFamily, ClientUse, AllowUserInstalledFonts); 102 103 String serifFamily(const String& locale); 104 String sansSerifFamily(const String& locale); 105 String cursiveFamily(const String& locale); 106 String fantasyFamily(const String& locale); 107 String monospaceFamily(const String& locale); 108 104 109 void clear(); 105 110 … … 115 120 116 121 HashMap<CascadeListParameters, Vector<RetainPtr<CTFontDescriptorRef>>, CascadeListParameters::CascadeListParametersHash, SimpleClassHashTraits<CascadeListParameters>> m_systemFontCache; 122 123 HashMap<String, String> m_serifFamilies; 124 HashMap<String, String> m_sansSeriferifFamilies; 125 HashMap<String, String> m_cursiveFamilies; 126 HashMap<String, String> m_fantasyFamilies; 127 HashMap<String, String> m_monospaceFamilies; 117 128 }; 118 129 119 130 } 120 121 #endif -
trunk/Tools/ChangeLog
r241283 r241288 1 2019-02-11 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Cocoa] Ask platform for generic font family mappings 4 https://bugs.webkit.org/show_bug.cgi?id=187723 5 <rdar://problem/41892438> 6 7 Reviewed by Brent Fulgham. 8 9 Allow testing infrastructure to use fonts that are returned from CTFontDescriptorCreateForCSSFamily(). 10 11 * DumpRenderTree/mac/DumpRenderTree.mm: 12 (allowedFontFamilySet): 13 * WebKitTestRunner/mac/TestControllerMac.mm: 14 (WTR::allowedFontFamilySet): 15 1 16 2019-02-11 Adrian Perez de Castro <aperez@igalia.com> 2 17 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r241268 r241288 378 378 @"Hiragino Mincho Pro", 379 379 @"Hiragino Mincho ProN", 380 @"Hiragino Sans", 380 381 @"Hiragino Sans GB", 381 382 @"Hoefler Text", … … 387 388 @"Krungthep", 388 389 @"KufiStandardGK", 390 @"Lao Sangam MN", 389 391 @"LastResort", 390 392 @"LiHei Pro", … … 404 406 @"PCMyungjo", 405 407 @"PilGi", 408 @"PingFang HK", 409 @"PingFang SC", 410 @"PingFang TC", 406 411 @"Plantagenet Cherokee", 407 412 @"Raanana", … … 409 414 @"Silom", 410 415 @"Skia", 416 @"Snell Roundhand", 411 417 @"Songti SC", 412 418 @"Songti TC", -
trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm
r241283 r241288 227 227 @"Hiragino Mincho Pro", 228 228 @"Hiragino Mincho ProN", 229 @"Hiragino Sans", 229 230 @"Hiragino Sans GB", 230 231 @"Hoefler Text", … … 236 237 @"Krungthep", 237 238 @"KufiStandardGK", 239 @"Lao Sangam MN", 238 240 @"LastResort", 239 241 @"LiHei Pro", … … 253 255 @"PCMyungjo", 254 256 @"PilGi", 257 @"PingFang HK", 258 @"PingFang SC", 259 @"PingFang TC", 255 260 @"Plantagenet Cherokee", 256 261 @"Raanana", … … 258 263 @"Silom", 259 264 @"Skia", 265 @"Snell Roundhand", 260 266 @"Songti SC", 261 267 @"Songti TC",
Note: See TracChangeset
for help on using the changeset viewer.