| Index: third_party/WebKit/Source/platform/fonts/linux/FontCacheLinux.cpp
|
| diff --git a/third_party/WebKit/Source/platform/fonts/linux/FontCacheLinux.cpp b/third_party/WebKit/Source/platform/fonts/linux/FontCacheLinux.cpp
|
| index 73a82163e164ad8dad6d54c2359c3d087ab487d6..683e5dd536ff0b8f9e5510c79254f269c99c8abc 100644
|
| --- a/third_party/WebKit/Source/platform/fonts/linux/FontCacheLinux.cpp
|
| +++ b/third_party/WebKit/Source/platform/fonts/linux/FontCacheLinux.cpp
|
| @@ -34,6 +34,17 @@
|
|
|
| namespace blink {
|
|
|
| +FontCache::FontCache()
|
| + : m_purgePreventCount(0)
|
| +{
|
| + if (s_fontManager) {
|
| + adopted(s_fontManager);
|
| + m_fontManager = s_fontManager;
|
| + } else {
|
| + m_fontManager = nullptr;
|
| + }
|
| +}
|
| +
|
| void FontCache::getFontForCharacter(UChar32 c, const char* preferredLocale, FontCache::PlatformFallbackFont* fallbackFont)
|
| {
|
| WebFallbackFont webFallbackFont;
|
| @@ -52,6 +63,17 @@ void FontCache::getFontForCharacter(UChar32 c, const char* preferredLocale, Font
|
| #if !OS(ANDROID)
|
| PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescription& fontDescription, UChar32 c, const SimpleFontData*)
|
| {
|
| + // The m_fontManager is set only if it was provided by the embedder with WebFontRendering::setSkiaFontManager. This is
|
| + // used to emulate android fonts on linux so we always request the family from the font manager and if none is found, we return
|
| + // the LastResort fallback font and avoid using FontCache::getFontForCharacter which would use sandbox support to
|
| + // query the underlying system for the font family.
|
| + if (m_fontManager) {
|
| + AtomicString familyName = getFamilyNameForCharacter(m_fontManager.get(), c, fontDescription);
|
| + if (familyName.isEmpty())
|
| + return getLastResortFallbackFont(fontDescription, DoNotRetain);
|
| + return fontDataFromFontPlatformData(getFontPlatformData(fontDescription, FontFaceCreationParams(familyName)), DoNotRetain);
|
| + }
|
| +
|
| // First try the specified font with standard style & weight.
|
| if (fontDescription.style() == FontStyleItalic
|
| || fontDescription.weight() >= FontWeight600) {
|
|
|