diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index 604e0703dc..5f8ea042f4 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -212,13 +212,12 @@ gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, nsTArray& aFontList) { 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); - } + EmojiPresentation eNext = GetEmojiPresentation(aNextCh); + if (aNextCh != kVariationSelector15 && + emoji != EmojiPresentation::TextOnly && + (emoji != EmojiPresentation::TextDefault || + eNext == EmojiPresentation::EmojiComponent)) { + aFontList.AppendElement(kFontTwemojiMozilla); } aFontList.AppendElement(kFontDejaVuSerif); diff --git a/gfx/thebes/gfxPlatformMac.cpp b/gfx/thebes/gfxPlatformMac.cpp index a5ffda452b..09be70bd3e 100644 --- a/gfx/thebes/gfxPlatformMac.cpp +++ b/gfx/thebes/gfxPlatformMac.cpp @@ -191,13 +191,12 @@ gfxPlatformMac::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, nsTArray& aFontList) { 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(kFontAppleColorEmoji); - } + EmojiPresentation eNext = GetEmojiPresentation(aNextCh); + if (aNextCh != kVariationSelector15 && + emoji != EmojiPresentation::TextOnly && + (emoji != EmojiPresentation::TextDefault || + eNext == EmojiPresentation::EmojiComponent)) { + aFontList.AppendElement(kFontAppleColorEmoji); } aFontList.AppendElement(kFontLucidaGrande); diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 100af6da7b..33ca2d9d2f 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -3113,10 +3113,11 @@ gfxFontGroup::WhichPrefFontSupportsChar(uint32_t aCh, uint32_t aNextCh) gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList(); EmojiPresentation emoji = GetEmojiPresentation(aCh); - if ((emoji != EmojiPresentation::TextOnly && - (aNextCh == kVariationSelector16 || - (emoji == EmojiPresentation::EmojiDefault && - aNextCh != kVariationSelector15)))) { + EmojiPresentation eNext = GetEmojiPresentation(aNextCh); + if (aNextCh != kVariationSelector15 && + emoji != EmojiPresentation::TextOnly && + (emoji != EmojiPresentation::TextDefault || + eNext == EmojiPresentation::EmojiComponent)) { charLang = eFontPrefLang_Emoji; } else { // get the pref font list if it hasn't been set up already diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index aa18ae8aff..5eac3fce65 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -638,14 +638,12 @@ gfxWindowsPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, nsTArray& aFontList) { 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 - // XXX: For Win8+ native, aFontList.AppendElement(kFontSegoeUIEmoji); - aFontList.AppendElement(kFontTwemojiMozilla); - } + EmojiPresentation eNext = GetEmojiPresentation(aNextCh); + if (aNextCh != kVariationSelector15 && + emoji != EmojiPresentation::TextOnly && + (emoji != EmojiPresentation::TextDefault || + eNext == EmojiPresentation::EmojiComponent)) { + aFontList.AppendElement(kFontTwemojiMozilla); } // Arial is used as the default fallback for system fallback diff --git a/intl/unicharutil/util/nsUnicodeProperties.h b/intl/unicharutil/util/nsUnicodeProperties.h index b41f7a3ba7..38fa230625 100644 --- a/intl/unicharutil/util/nsUnicodeProperties.h +++ b/intl/unicharutil/util/nsUnicodeProperties.h @@ -48,7 +48,8 @@ enum IdentifierType { enum EmojiPresentation { TextOnly = 0, TextDefault = 1, - EmojiDefault = 2 + EmojiDefault = 2, + EmojiComponent = 3 }; const uint32_t kVariationSelector15 = 0xFE0E; // text presentation @@ -179,14 +180,17 @@ IsDefaultIgnorable(uint32_t aCh) inline EmojiPresentation GetEmojiPresentation(uint32_t aCh) { - if (!u_hasBinaryProperty(aCh, UCHAR_EMOJI)) { - return TextOnly; + if (u_hasBinaryProperty(aCh, UCHAR_EMOJI_COMPONENT)) { + return EmojiComponent; } - - if (u_hasBinaryProperty(aCh, UCHAR_EMOJI_PRESENTATION)) { + if (u_hasBinaryProperty(aCh, UCHAR_EMOJI) && + !u_hasBinaryProperty(aCh, UCHAR_EMOJI_PRESENTATION)) { + return TextDefault; + } + if (u_hasBinaryProperty(aCh, UCHAR_EXTENDED_PICTOGRAPHIC)) { return EmojiDefault; } - return TextDefault; + return TextOnly; } // returns the simplified Gen Category as defined in nsIUGenCategory