From 2619698a2eb7363940d1e6a2d71a9ce7b366d3f5 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 9 May 2018 17:52:17 +0200 Subject: Font fallback should detect emoji range for color emoji font. --- gfx/thebes/gfxWindowsPlatform.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'gfx/thebes/gfxWindowsPlatform.cpp') diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index af4d932a9..c68f622c6 100755 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -13,6 +13,7 @@ #include "gfxWindowsSurface.h" #include "nsUnicharUtils.h" +#include "nsUnicodeProperties.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" @@ -81,6 +82,7 @@ using namespace mozilla::gfx; using namespace mozilla::layers; using namespace mozilla::widget; using namespace mozilla::image; +using namespace mozilla::unicode; IDWriteRenderingParams* GetDwriteRenderingParams(bool aGDI) { @@ -669,9 +671,15 @@ gfxWindowsPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, Script aRunScript, nsTArray& aFontList) { - if (aNextCh == 0xfe0fu) { - aFontList.AppendElement(kFontSegoeUIEmoji); - 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 + // XXX: For Win8+ native, aFontList.AppendElement(kFontSegoeUIEmoji); + aFontList.AppendElement(kFontTwemojiMozilla); + } } // Arial is used as the default fallback for system fallback @@ -680,17 +688,7 @@ gfxWindowsPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, if (!IS_IN_BMP(aCh)) { uint32_t p = aCh >> 16; if (p == 1) { // SMP plane - if (aNextCh == 0xfe0eu) { - aFontList.AppendElement(kFontSegoeUISymbol); - aFontList.AppendElement(kFontSegoeUIEmoji); - aFontList.AppendElement(kFontTwemojiMozilla); - } else { - if (aNextCh != 0xfe0fu) { - aFontList.AppendElement(kFontSegoeUIEmoji); - aFontList.AppendElement(kFontTwemojiMozilla); - } - aFontList.AppendElement(kFontSegoeUISymbol); - } + aFontList.AppendElement(kFontSegoeUISymbol); aFontList.AppendElement(kFontEbrima); aFontList.AppendElement(kFontNirmalaUI); aFontList.AppendElement(kFontCambriaMath); -- cgit v1.2.3