Changeset 241229 in webkit
- Timestamp:
- Feb 8, 2019 7:42:23 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r241219 r241229 1 2019-02-08 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. This test is no longer testing 13 anything relevant. 14 * fast/text/international/lang-sensitive-fonts-expected.html: 15 * fast/text/international/lang-sensitive-fonts-xml-expected.html: 16 * fast/text/international/lang-sensitive-fonts-xml.xhtml: 17 * fast/text/international/lang-sensitive-fonts.html: 18 * fast/text/international/locale-sensitive-fonts-expected.html: 19 * fast/text/international/locale-sensitive-fonts.html: 20 * fast/text/ja-sans-serif-expected-mismatch.html: Added. 21 * fast/text/ja-sans-serif.html: Added. 22 1 23 2019-02-08 Joseph Pecoraro <pecoraro@apple.com> 2 24 -
trunk/LayoutTests/fast/text/international/lang-sensitive-fonts-expected.html
r110936 r241229 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
r110936 r241229 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
r189038 r241229 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
r189038 r241229 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
r110808 r241229 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
r189038 r241229 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
r199034 r241229 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/wtf/Platform.h
r241169 r241229 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
r241222 r241229 1 2019-02-08 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::SystemFontDatabaseCoreText::serifFamily): 48 (WebCore::SystemFontDatabaseCoreText::sansSerifFamily): 49 (WebCore::SystemFontDatabaseCoreText::cursiveFamily): 50 (WebCore::SystemFontDatabaseCoreText::fantasyFamily): 51 (WebCore::SystemFontDatabaseCoreText::monospaceFamily): 52 * platform/graphics/cocoa/SystemFontDatabaseCoreText.h: 53 1 54 2019-02-08 Yusuke Suzuki <ysuzuki@apple.com> 2 55 -
trunk/Source/WebCore/PAL/ChangeLog
r241183 r241229 1 2019-02-08 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-07 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
r237266 r241229 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
r240472 r241229 1721 1721 } 1722 1722 1723 1724 1723 static CSSValueID identifierForFamily(const AtomicString& family) 1725 1724 { -
trunk/Source/WebCore/css/CSSFontSelector.cpp
r235897 r241229 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
r240641 r241229 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
r240592 r241229 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
r236938 r241229 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
r239427 r241229 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
r237266 r241229 28 28 29 29 #include "SystemFontDatabaseCoreText.h" 30 #include <mutex> 31 #include <wtf/Language.h> 30 32 31 33 #if USE_PLATFORM_SYSTEM_FALLBACK_LIST … … 139 141 } 140 142 143 static String computeSpecializedChineseLocale() 144 { 145 const Vector<String>& preferredLanguages = userPreferredLanguages(); 146 for (auto& language : preferredLanguages) { 147 if (equalIgnoringASCIICase(language, "zh") || startsWithLettersIgnoringASCIICase(language, "zh-")) 148 return language; 149 } 150 return "zh-hans"_str; // We have no signal. Pick one option arbitrarily. 151 } 152 153 static String& cachedSpecializedChineseLocale() 154 { 155 static NeverDestroyed<String> specializedChineseLocale; 156 return specializedChineseLocale.get(); 157 } 158 159 static void languageChanged(void*) 160 { 161 cachedSpecializedChineseLocale() = computeSpecializedChineseLocale(); 162 } 163 164 AtomicString FontDescription::platformResolveGenericFamily(UScriptCode script, const AtomicString& locale, const AtomicString& familyName) 165 { 166 if (script == USCRIPT_COMMON) 167 return nullAtom(); 168 169 static std::once_flag onceFlag; 170 std::call_once(onceFlag, [&] { 171 static int dummy; 172 addLanguageChangeObserver(&dummy, &languageChanged); // We will never remove the observer, so all we need is a non-null pointer. 173 languageChanged(nullptr); 174 }); 175 176 // FIXME: Delete this once <rdar://problem/47682577> is fixed. 177 auto& usedLocale = script == USCRIPT_HAN ? cachedSpecializedChineseLocale() : locale.string(); 178 179 // FIXME: Use the system font database to handle standardFamily 180 if (familyName == serifFamily) 181 return SystemFontDatabaseCoreText::singleton().serifFamily(usedLocale); 182 if (familyName == sansSerifFamily) 183 return SystemFontDatabaseCoreText::singleton().sansSerifFamily(usedLocale); 184 if (familyName == cursiveFamily) 185 return SystemFontDatabaseCoreText::singleton().cursiveFamily(usedLocale); 186 if (familyName == fantasyFamily) 187 return SystemFontDatabaseCoreText::singleton().fantasyFamily(usedLocale); 188 if (familyName == monospaceFamily) 189 return SystemFontDatabaseCoreText::singleton().monospaceFamily(usedLocale); 190 191 return nullAtom(); 192 } 193 141 194 } 142 195 -
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
r237266 r241229 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 177 #endif 180 String SystemFontDatabaseCoreText::serifFamily(const String& locale) 181 { 182 return m_serifFamilies.ensure(locale, [&] { 183 auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilySerif, locale.createCFString().get())); 184 return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); 185 }).iterator->value; 186 } 187 188 String SystemFontDatabaseCoreText::sansSerifFamily(const String& locale) 189 { 190 return m_sansSeriferifFamilies.ensure(locale, [&] { 191 auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilySansSerif, locale.createCFString().get())); 192 return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); 193 }).iterator->value; 194 } 195 196 String SystemFontDatabaseCoreText::cursiveFamily(const String& locale) 197 { 198 return m_cursiveFamilies.ensure(locale, [&] { 199 auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilyCursive, locale.createCFString().get())); 200 return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); 201 }).iterator->value; 202 } 203 204 String SystemFontDatabaseCoreText::fantasyFamily(const String& locale) 205 { 206 return m_fantasyFamilies.ensure(locale, [&] { 207 auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilyFantasy, locale.createCFString().get())); 208 return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); 209 }).iterator->value; 210 } 211 212 String SystemFontDatabaseCoreText::monospaceFamily(const String& locale) 213 { 214 return m_monospaceFamilies.ensure(locale, [&] { 215 auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilyMonospace, locale.createCFString().get())); 216 String result = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); 217 #if PLATFORM(MAC) && ENABLE(MONOSPACE_FONT_EXCEPTION) 218 // In general, CoreText uses Monaco for monospaced (see: Terminal.app and Xcode.app). 219 // For now, we want to use Courier for web compatibility, until we have more time to do compatibility testing. 220 if (equalLettersIgnoringASCIICase(result, "monaco")) 221 return "Courier"_str; 222 #elif PLATFORM(IOS_FAMILY) && ENABLE(MONOSPACE_FONT_EXCEPTION) 223 if (equalLettersIgnoringASCIICase(result, "courier new")) 224 return "Courier"_str; 225 #endif 226 return result; 227 }).iterator->value; 228 } 229 230 } 231 232 #endif -
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h
r236938 r241229 102 102 103 103 Vector<RetainPtr<CTFontDescriptorRef>> cascadeList(const FontCascadeDescription&, const AtomicString& cssFamily, ClientUse, AllowUserInstalledFonts); 104 105 String serifFamily(const String& locale); 106 String sansSerifFamily(const String& locale); 107 String cursiveFamily(const String& locale); 108 String fantasyFamily(const String& locale); 109 String monospaceFamily(const String& locale); 110 104 111 void clear(); 105 112 … … 115 122 116 123 HashMap<CascadeListParameters, Vector<RetainPtr<CTFontDescriptorRef>>, CascadeListParameters::CascadeListParametersHash, SimpleClassHashTraits<CascadeListParameters>> m_systemFontCache; 124 125 HashMap<String, String> m_serifFamilies; 126 HashMap<String, String> m_sansSeriferifFamilies; 127 HashMap<String, String> m_cursiveFamilies; 128 HashMap<String, String> m_fantasyFamilies; 129 HashMap<String, String> m_monospaceFamilies; 117 130 }; 118 131 -
trunk/Tools/ChangeLog
r241224 r241229 1 2019-02-08 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-08 Alexander Mikhaylenko <exalm7659@gmail.com> 2 17 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r240700 r241229 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
r239871 r241229 223 223 @"Hiragino Mincho Pro", 224 224 @"Hiragino Mincho ProN", 225 @"Hiragino Sans", 225 226 @"Hiragino Sans GB", 226 227 @"Hoefler Text", … … 232 233 @"Krungthep", 233 234 @"KufiStandardGK", 235 @"Lao Sangam MN", 234 236 @"LastResort", 235 237 @"LiHei Pro", … … 249 251 @"PCMyungjo", 250 252 @"PilGi", 253 @"PingFang HK", 254 @"PingFang SC", 255 @"PingFang TC", 251 256 @"Plantagenet Cherokee", 252 257 @"Raanana", … … 254 259 @"Silom", 255 260 @"Skia", 261 @"Snell Roundhand", 256 262 @"Songti SC", 257 263 @"Songti TC",
Note: See TracChangeset
for help on using the changeset viewer.