summaryrefslogtreecommitdiff
path: root/gfx/thebes/gfxPlatformGtk.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-05-09 17:52:17 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-05-09 17:52:17 +0200
commit474136b0491e6cc4d2878641f0055dfb512a1618 (patch)
treea0e493460026b72f243d932f401409f26ee9a89e /gfx/thebes/gfxPlatformGtk.cpp
parentba41c29077c91cdaf82f7e4620927425ece3c7b2 (diff)
downloaduxp-474136b0491e6cc4d2878641f0055dfb512a1618.tar.gz
Font fallback should detect emoji range for color emoji font.
Diffstat (limited to 'gfx/thebes/gfxPlatformGtk.cpp')
-rw-r--r--gfx/thebes/gfxPlatformGtk.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
index 1fb3bc4fd8..be75332d65 100644
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -240,9 +240,14 @@ gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
Script aRunScript,
nsTArray<const char*>& aFontList)
{
- if (aNextCh == 0xfe0fu) {
- // if char is followed by VS16, try for a color emoji glyph
- aFontList.AppendElement(kFontTwemojiMozilla);
+ EmojiPresentation emoji = GetEmojiPresentation(aCh);
+ if (emoji != EmojiPresentation::TextOnly) {
+ if (aNextCh == kVariationSelector16 ||
+ (aNextCh != kVariationSelector15 &&
+ emoji == EmojiPresentation::EmojiDefault)) {
+ // if char is followed by VS16, try for a color emoji glyph
+ aFontList.AppendElement(kFontTwemojiMozilla);
+ }
}
aFontList.AppendElement(kFontDejaVuSerif);
@@ -250,15 +255,6 @@ gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
aFontList.AppendElement(kFontDejaVuSans);
aFontList.AppendElement(kFontFreeSans);
- if (!IS_IN_BMP(aCh)) {
- uint32_t p = aCh >> 16;
- if (p == 1) { // try color emoji font, unless VS15 (text style) present
- if (aNextCh != 0xfe0fu && aNextCh != 0xfe0eu) {
- aFontList.AppendElement(kFontTwemojiMozilla);
- }
- }
- }
-
// add fonts for CJK ranges
// xxx - this isn't really correct, should use the same CJK font ordering
// as the pref font code