Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Unified Diff: third_party/WebKit/Source/platform/fonts/linux/FontCacheLinux.cpp

Issue 1757703003: Extend FontCache fallback API to support FontFallbackPriority (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9dad8c839375728a68bd055471b03c0f9713a880 100644
--- a/third_party/WebKit/Source/platform/fonts/linux/FontCacheLinux.cpp
+++ b/third_party/WebKit/Source/platform/fonts/linux/FontCacheLinux.cpp
@@ -50,11 +50,24 @@ void FontCache::getFontForCharacter(UChar32 c, const char* preferredLocale, Font
}
#if !OS(ANDROID)
-PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescription& fontDescription, UChar32 c, const SimpleFontData*)
+PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(
+ const FontDescription& fontDescription,
+ UChar32 c,
+ const SimpleFontData*,
+ FontFallbackPriority fallbackPriority)
{
+ if (fallbackPriority == FontFallbackPriority::EmojiEmoji) {
+ // FIXME crbug.com/591346: We're overriding the fallback character here
+ // with the FAMILY emoji in the hope to find a suitable emoji font.
+ // This should be improved by supporting fallback for character
+ // sequences like DIGIT ONE + COMBINING keycap etc.
+ c = familyCharacter;
+ }
+
// First try the specified font with standard style & weight.
- if (fontDescription.style() == FontStyleItalic
- || fontDescription.weight() >= FontWeight600) {
+ if (fallbackPriority != FontFallbackPriority::EmojiEmoji
+ && (fontDescription.style() == FontStyleItalic
+ || fontDescription.weight() >= FontWeight600)) {
RefPtr<SimpleFontData> fontData = fallbackOnStandardFontStyle(
fontDescription, c);
if (fontData)

Powered by Google App Engine
This is Rietveld 408576698