Chromium Code Reviews| Index: third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp |
| diff --git a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp |
| index 591ba4f2cbf8872ef6eac5ec127e8ec2ee268ed0..7fa21205653ba5f7b2e788eb81bed1331ac889f8 100644 |
| --- a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp |
| +++ b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp |
| @@ -43,6 +43,35 @@ |
| #include "wtf/text/CString.h" |
| #include <unicode/locid.h> |
| +// Unfortunately, these chosen font names require a bit of experimentation and |
| +// researching on the respective platforms as to what works best and is widely |
| +// available. They may require further manual tuning. Mozilla's choices in the |
| +// gfxPlatform*::GetCommonFallbackFonts methods collects some of the outcome of |
| +// this experimentation. On Android, the available fonts in |
| +// /system/etc/fonts.xml give a clearer picture of which fonts are available and |
| +// can be widely used successfully. On Linux, updating and improving this list |
| +// requires finding out widely used distribution fonts, for example on current |
| +// Ubuntu versions. |
| +#if OS(WIN) |
| +const char* kColorEmojiFonts[] = { "Segoe UI Emoji" }; |
| +const char* kTextEmojiFonts[] = { "Segoe UI Symbol" }; |
| +const char* kSymbolsFonts[] = { "Segoe UI Symbol" }; |
| +const char* kMathFonts[] = { "Cambria Math", "Segoe UI Symbol", "Code2000" }; |
| +#elif OS(ANDROID) |
| +// Due to crbug.com/322658 we cannot properly specify Android font family names here, |
| +// The way Skia's SkFontMgr_android gives them canonical names, we can however |
| +// reference the Noto Color Emoji font under "56##fallback" on Android 6.0.1 |
| +const char* kColorEmojiFonts[] = { "56##fallback", "Noto Color Emoji", "Android Emoji" }; |
| +const char* kTextEmojiFonts[] = { "Droid Sans Fallback" }; |
| +const char* kSymbolsFonts[] = { "Droid Sans Fallback" }; |
| +const char* kMathFonts[] = { "Droid Sans Fallback" }; |
| +#elif OS(LINUX) |
| +const char* kColorEmojiFonts[] = { "Noto Color Emoji", "Noto Sans Symbols", "Symbola" }; |
| +const char* kTextEmojiFonts[] = { "Noto Sans Symbols", "Symbola" }; |
| +const char* kSymbolsFonts[] = { "FreeSerif", "FreeMono" }; |
| +const char* kMathFonts[] = { "FreeSerif", "FreeMono" }; |
| +#endif |
| + |
| #if !OS(WIN) && !OS(ANDROID) |
| #include "SkFontConfigInterface.h" |
| @@ -161,6 +190,33 @@ PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescri |
| return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); |
| } |
| + |
|
wkorman
2016/02/02 19:04:08
-1 blank
|
| +const Vector<AtomicString> FontCache::platformFontListForFallbackPriority(FontFallbackPriority fallbackPriority) const |
| +{ |
| + Vector<AtomicString> returnVector; |
| + switch (fallbackPriority) { |
| + case FontFallbackPriority::EmojiEmoji: |
| + for (size_t i = 0; i < WTF_ARRAY_LENGTH(kColorEmojiFonts); ++i) |
|
wkorman
2016/02/02 19:04:08
Could just set local var to the right array for ea
drott
2016/02/02 22:27:01
I've tried doing that but an array cannot be assig
|
| + returnVector.append(kColorEmojiFonts[i]); |
| + break; |
| + case FontFallbackPriority::EmojiText: |
| + for (size_t i = 0; i < WTF_ARRAY_LENGTH(kTextEmojiFonts); ++i) |
| + returnVector.append(kTextEmojiFonts[i]); |
| + break; |
| + case FontFallbackPriority::Math: |
| + for (size_t i = 0; i < WTF_ARRAY_LENGTH(kMathFonts); ++i) |
| + returnVector.append(kMathFonts[i]); |
| + break; |
| + case FontFallbackPriority::Symbols: |
| + for (size_t i = 0; i < WTF_ARRAY_LENGTH(kSymbolsFonts); ++i) |
| + returnVector.append(kSymbolsFonts[i]); |
| + break; |
| + default: |
| + ASSERT_NOT_REACHED(); |
| + } |
| + return returnVector; |
| +} |
| + |
| #if OS(WIN) |
| static inline SkFontStyle fontStyle(const FontDescription& fontDescription) |
| { |