Changeset 248071 in webkit
- Timestamp:
- Jul 31, 2019 1:59:00 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r248046 r248071 1 2019-07-31 Youenn Fablet <youenn@apple.com> 2 3 Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage 4 https://bugs.webkit.org/show_bug.cgi?id=200241 5 6 We update the tests to flush font caches as otherwise some debug asserts would be hit. 7 This is due to changing the user installed font runtime flag while browsing which is not a typical situation. 8 9 Reviewed by Myles C. Maxfield. 10 11 * fast/text/user-installed-fonts/extended-character-with-user-font.html: 12 * fast/text/user-installed-fonts/extended-character.html: 13 1 14 2019-07-31 Youenn Fablet <youenn@apple.com> 2 15 -
trunk/LayoutTests/fast/text/user-installed-fonts/extended-character-with-user-font.html
r247566 r248071 6 6 <body> 7 7 <script> 8 if (window.internals) 9 internals.invalidateFontCache(); 8 10 if (window.testRunner) 9 11 testRunner.installFakeHelvetica("SingleExtendedCharacter"); -
trunk/LayoutTests/fast/text/user-installed-fonts/extended-character.html
r247566 r248071 6 6 <body> 7 7 <script> 8 if (window.internals) 8 if (window.internals) { 9 internals.invalidateFontCache(); 9 10 internals.settings.setShouldAllowUserInstalledFonts(false); 11 } 10 12 if (window.testRunner) 11 13 testRunner.installFakeHelvetica("SingleExtendedCharacter"); -
trunk/Source/WTF/ChangeLog
r248044 r248071 1 2019-07-31 Youenn Fablet <youenn@apple.com> 2 3 Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage 4 https://bugs.webkit.org/show_bug.cgi?id=200241 5 6 Reviewed by Myles C. Maxfield. 7 8 * wtf/Platform.h: Add macro to enable/disable new SPI. 9 1 10 2019-07-31 Keith Rollin <krollin@apple.com> 2 11 -
trunk/Source/WTF/wtf/Platform.h
r248018 r248071 1545 1545 #endif 1546 1546 1547 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) 1548 #define HAVE_CTFONTCREATEFORCHARACTERSWITHLANGUAGEANDOPTION 1 1549 #endif 1550 1547 1551 #if PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000 1548 1552 #define HAVE_ARKIT_QUICK_LOOK_PREVIEW_ITEM 1 -
trunk/Source/WebCore/ChangeLog
r248053 r248071 1 2019-07-31 Youenn Fablet <youenn@apple.com> 2 3 Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage 4 https://bugs.webkit.org/show_bug.cgi?id=200241 5 6 Reviewed by Myles C. Maxfield. 7 8 We can use CTFontCreateForCharactersWithLanguageAndOption instead of CTFontCreateForCharactersWithLanguage 9 as it allows setting more easily the fallback option. 10 This allows us to never fallback to user installed fonts. 11 In such a case, we no longer need to wrap the fonts to change the fallback option. 12 We also prewarm the fonts with the same SPI and use system fallback as the default value. 13 14 Covered by existing tests. 15 16 * platform/graphics/cocoa/FontCacheCoreText.cpp: 17 (WebCore::preparePlatformFont): 18 (WebCore::lookupFallbackFont): 19 (WebCore::FontCache::systemFallbackForCharacters): 20 (WebCore::FontCache::prewarm): 21 (WebCore::fontFamiliesForPrewarming): 22 1 23 2019-07-31 Devin Rousso <drousso@apple.com> 2 24 -
trunk/Source/WebCore/PAL/ChangeLog
r247841 r248071 1 2019-07-31 Youenn Fablet <youenn@apple.com> 2 3 Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage 4 https://bugs.webkit.org/show_bug.cgi?id=200241 5 6 Reviewed by Myles C. Maxfield. 7 8 Add new SPI. 9 10 * pal/spi/cocoa/CoreTextSPI.h: 11 1 12 2019-07-25 Brent Fulgham <bfulgham@apple.com> 2 13 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
r247674 r248071 133 133 CTFontRef CTFontCreateForCSS(CFStringRef name, uint16_t weight, CTFontSymbolicTraits, CGFloat size); 134 134 CTFontRef CTFontCreateForCharactersWithLanguage(CTFontRef currentFont, const UTF16Char *characters, CFIndex length, CFStringRef language, CFIndex *coveredLength); 135 CTFontRef CTFontCreateForCharactersWithLanguageAndOption(CTFontRef currentFont, const UTF16Char *characters, CFIndex length, CFStringRef language, CTFontFallbackOption option, CFIndex *coveredLength); 135 136 CTFontRef CTFontCopyPhysicalFont(CTFontRef); 136 137 -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r247720 r248071 571 571 bool fontFaceDoesntSpecifyFeatures = !fontFaceFeatures || fontFaceFeatures->isEmpty(); 572 572 bool fontFaceDoesntSpecifyVariations = !fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal(); 573 if (noFontFeatureSettings && noFontVariationSettings && textRenderingModeIsAuto && variantSettingsIsNormal && dontNeedToApplyOpticalSizing && fontFaceDoesntSpecifyFeatures && fontFaceDoesntSpecifyVariations) 573 if (noFontFeatureSettings && noFontVariationSettings && textRenderingModeIsAuto && variantSettingsIsNormal && dontNeedToApplyOpticalSizing && fontFaceDoesntSpecifyFeatures && fontFaceDoesntSpecifyVariations) { 574 #if HAVE(CTFONTCREATEFORCHARACTERSWITHLANGUAGEANDOPTION) 575 return originalFont; 576 #else 574 577 return createFontForInstalledFonts(originalFont, fontDescription.shouldAllowUserInstalledFonts()); 578 #endif 579 } 575 580 576 581 // This algorithm is described at http://www.w3.org/TR/css3-fonts/#feature-precedence … … 884 889 , capabilities(capabilitiesForFontDescriptor(fontDescriptor)) 885 890 { 891 #if HAVE(CTFONTCREATEFORCHARACTERSWITHLANGUAGEANDOPTION) 892 UNUSED_PARAM(allowUserInstalledFonts); 893 #else 886 894 if (allowUserInstalledFonts != AllowUserInstalledFonts::No) 887 895 return; … … 889 897 addAttributesForInstalledFonts(attributes.get(), allowUserInstalledFonts); 890 898 this->fontDescriptor = CTFontDescriptorCreateCopyWithAttributes(fontDescriptor, attributes.get()); 899 #endif 891 900 } 892 901 … … 1391 1400 #endif 1392 1401 1393 static RetainPtr<CTFontRef> lookupFallbackFont(CTFontRef font, FontSelectionValue fontWeight, const AtomString& locale, const UChar* characters, unsigned length) 1402 #if !ASSERT_DISABLED 1403 static inline bool isUserInstalledFont(CTFontRef font) 1404 { 1405 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 1406 auto isUserInstalledFont = adoptCF(static_cast<CFBooleanRef>(CTFontCopyAttribute(font, kCTFontUserInstalledAttribute))); 1407 return isUserInstalledFont && CFBooleanGetValue(isUserInstalledFont.get()); 1408 #else 1409 UNUSED_PARAM(font); 1410 return false; 1411 #endif 1412 } 1413 #endif 1414 1415 #if !USE(PLATFORM_SYSTEM_FALLBACK_LIST) && (PLATFORM(MAC) || (PLATFORM(IOS_FAMILY) && TARGET_OS_IOS)) 1416 static RetainPtr<CTFontRef> createFontForCharacters(CTFontRef font, CFStringRef localeString, AllowUserInstalledFonts, const UChar* characters, unsigned length) 1417 { 1418 CFIndex coveredLength = 0; 1419 return adoptCF(CTFontCreatePhysicalFontForCharactersWithLanguage(font, characters, length, localeString, &coveredLength)); 1420 } 1421 #elif HAVE(CTFONTCREATEFORCHARACTERSWITHLANGUAGEANDOPTION) 1422 static RetainPtr<CTFontRef> createFontForCharacters(CTFontRef font, CFStringRef localeString, AllowUserInstalledFonts allowUserInstalledFonts, const UChar* characters, unsigned length) 1423 { 1424 CFIndex coveredLength = 0; 1425 auto fallbackOption = allowUserInstalledFonts == AllowUserInstalledFonts::No ? kCTFontFallbackOptionSystem : kCTFontFallbackOptionDefault; 1426 return adoptCF(CTFontCreateForCharactersWithLanguageAndOption(font, characters, length, localeString, fallbackOption, &coveredLength)); 1427 } 1428 #else 1429 static RetainPtr<CTFontRef> createFontForCharacters(CTFontRef font, CFStringRef localeString, AllowUserInstalledFonts, const UChar* characters, unsigned length) 1430 { 1431 CFIndex coveredLength = 0; 1432 return adoptCF(CTFontCreateForCharactersWithLanguage(font, characters, length, localeString, &coveredLength)); 1433 } 1434 #endif 1435 1436 static RetainPtr<CTFontRef> lookupFallbackFont(CTFontRef font, FontSelectionValue fontWeight, const AtomString& locale, AllowUserInstalledFonts allowUserInstalledFonts, const UChar* characters, unsigned length) 1394 1437 { 1395 1438 ASSERT(length > 0); … … 1403 1446 #endif 1404 1447 1405 CFIndex coveredLength = 0; 1406 RetainPtr<CTFontRef> result; 1407 #if !USE(PLATFORM_SYSTEM_FALLBACK_LIST) && (PLATFORM(MAC) || (PLATFORM(IOS_FAMILY) && TARGET_OS_IOS)) 1408 result = adoptCF(CTFontCreatePhysicalFontForCharactersWithLanguage(font, characters, length, localeString.get(), &coveredLength)); 1409 #else 1410 result = adoptCF(CTFontCreateForCharactersWithLanguage(font, characters, length, localeString.get(), &coveredLength)); 1411 #endif 1448 auto result = createFontForCharacters(font, localeString.get(), allowUserInstalledFonts, characters, length); 1449 ASSERT(!isUserInstalledFont(result.get()) || allowUserInstalledFonts == AllowUserInstalledFonts::Yes); 1412 1450 1413 1451 #if PLATFORM(IOS_FAMILY) … … 1450 1488 m_fontNamesRequiringSystemFallbackForPrewarming.add(fullName); 1451 1489 1452 auto result = lookupFallbackFont(platformData.font(), description.weight(), description.locale(), characters, length);1490 auto result = lookupFallbackFont(platformData.font(), description.weight(), description.locale(), description.shouldAllowUserInstalledFonts(), characters, length); 1453 1491 result = preparePlatformFont(result.get(), description, nullptr, nullptr, { }); 1454 1492 … … 1649 1687 CFIndex coveredLength = 0; 1650 1688 UChar character = ' '; 1689 1690 #if HAVE(CTFONTCREATEFORCHARACTERSWITHLANGUAGEANDOPTION) 1691 auto fallbackWarmingFont = adoptCF(CTFontCreateForCharactersWithLanguageAndOption(warmingFont.get(), &character, 1, nullptr, kCTFontFallbackOptionSystem, &coveredLength)); 1692 #else 1651 1693 auto fallbackWarmingFont = adoptCF(CTFontCreateForCharactersWithLanguage(warmingFont.get(), &character, 1, nullptr, &coveredLength)); 1694 #endif 1652 1695 } 1653 1696 }
Note: See TracChangeset
for help on using the changeset viewer.