Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCrea...
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jul 2019 20:59:00 +0000 (20:59 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jul 2019 20:59:00 +0000 (20:59 +0000)
commit1ee163edabb3c6415ed4dff8211ce442de8fa607
treeda28d8739031a20d8bdba7f4bcd7951a326b26ac
parent35201f417c3d10c91c56e7580cafca5c7d1ae1e1
Use CTFontCreateForCharactersWithLanguageAndOption if available instead of CTFontCreateForCharactersWithLanguage
https://bugs.webkit.org/show_bug.cgi?id=200241

Source/WebCore:

Reviewed by Myles C. Maxfield.

We can use CTFontCreateForCharactersWithLanguageAndOption instead of CTFontCreateForCharactersWithLanguage
as it allows setting more easily the fallback option.
This allows us to never fallback to user installed fonts.
In such a case, we no longer need to wrap the fonts to change the fallback option.
We also prewarm the fonts with the same SPI and use system fallback as the default value.

Covered by existing tests.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::preparePlatformFont):
(WebCore::lookupFallbackFont):
(WebCore::FontCache::systemFallbackForCharacters):
(WebCore::FontCache::prewarm):
(WebCore::fontFamiliesForPrewarming):

Source/WebCore/PAL:

Reviewed by Myles C. Maxfield.

Add new SPI.

* pal/spi/cocoa/CoreTextSPI.h:

Source/WTF:

Reviewed by Myles C. Maxfield.

* wtf/Platform.h: Add macro to enable/disable new SPI.

LayoutTests:

We update the tests to flush font caches as otherwise some debug asserts would be hit.
This is due to changing the user installed font runtime flag while browsing which is not a typical situation.

Reviewed by Myles C. Maxfield.

* fast/text/user-installed-fonts/extended-character-with-user-font.html:
* fast/text/user-installed-fonts/extended-character.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/text/user-installed-fonts/extended-character-with-user-font.html
LayoutTests/fast/text/user-installed-fonts/extended-character.html
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp