diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-05-09 19:41:33 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-05-09 19:41:33 +0200 |
commit | fd2b227f19844978021811e9e1a60b8bcbd1ecad (patch) | |
tree | a378867115a91a3f33ff019f2c303b0406b1c688 /gfx/thebes/gfxTextRun.cpp | |
parent | aa662adcfc086965ee9ecdcf4d2c01a1c4869efa (diff) | |
parent | 2619698a2eb7363940d1e6a2d71a9ce7b366d3f5 (diff) | |
download | UXP-fd2b227f19844978021811e9e1a60b8bcbd1ecad.tar UXP-fd2b227f19844978021811e9e1a60b8bcbd1ecad.tar.gz UXP-fd2b227f19844978021811e9e1a60b8bcbd1ecad.tar.lz UXP-fd2b227f19844978021811e9e1a60b8bcbd1ecad.tar.xz UXP-fd2b227f19844978021811e9e1a60b8bcbd1ecad.zip |
Merge branch 'intl-ICU-emoji-work'
Diffstat (limited to 'gfx/thebes/gfxTextRun.cpp')
-rw-r--r-- | gfx/thebes/gfxTextRun.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 6718eed01..1702cab66 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -2813,7 +2813,7 @@ gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh, uint32_t aNextCh, return nullptr; // 2. search pref fonts - RefPtr<gfxFont> font = WhichPrefFontSupportsChar(aCh); + RefPtr<gfxFont> font = WhichPrefFontSupportsChar(aCh, aNextCh); if (font) { *aMatchType = gfxTextRange::kPrefsFallback; return font.forget(); @@ -3081,15 +3081,25 @@ gfxFontGroup::ContainsUserFont(const gfxUserFontEntry* aUserFont) } already_AddRefed<gfxFont> -gfxFontGroup::WhichPrefFontSupportsChar(uint32_t aCh) +gfxFontGroup::WhichPrefFontSupportsChar(uint32_t aCh, uint32_t aNextCh) { RefPtr<gfxFont> font; - // get the pref font list if it hasn't been set up already - uint32_t unicodeRange = FindCharUnicodeRange(aCh); + eFontPrefLang charLang; gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList(); - eFontPrefLang charLang = pfl->GetFontPrefLangFor(unicodeRange); + EmojiPresentation emoji = GetEmojiPresentation(aCh); + if ((emoji != EmojiPresentation::TextOnly && + (aNextCh == kVariationSelector16 || + (emoji == EmojiPresentation::EmojiDefault && + aNextCh != kVariationSelector15)))) { + charLang = eFontPrefLang_Emoji; + } else { + // get the pref font list if it hasn't been set up already + uint32_t unicodeRange = FindCharUnicodeRange(aCh); + charLang = pfl->GetFontPrefLangFor(unicodeRange); + } + // if the last pref font was the first family in the pref list, no need to recheck through a list of families if (mLastPrefFont && charLang == mLastPrefLang && mLastPrefFirstFont && mLastPrefFont->HasCharacter(aCh)) { |