summaryrefslogtreecommitdiffstats
path: root/gfx/thebes/gfxTextRun.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-05-09 15:30:43 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-05-09 15:30:43 +0200
commit84c479afa375c7cb6cd38dbaf0547636046b8cb5 (patch)
treed1d6d35fd20b1e4b6af08033b5b492e8ee1eaacb /gfx/thebes/gfxTextRun.cpp
parent78430deb89ca5fb35588e73a35a3c702523f0345 (diff)
downloadUXP-84c479afa375c7cb6cd38dbaf0547636046b8cb5.tar
UXP-84c479afa375c7cb6cd38dbaf0547636046b8cb5.tar.gz
UXP-84c479afa375c7cb6cd38dbaf0547636046b8cb5.tar.lz
UXP-84c479afa375c7cb6cd38dbaf0547636046b8cb5.tar.xz
UXP-84c479afa375c7cb6cd38dbaf0547636046b8cb5.zip
Use font.name-list.emoji preference for emoji presenration.
Diffstat (limited to 'gfx/thebes/gfxTextRun.cpp')
-rw-r--r--gfx/thebes/gfxTextRun.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp
index 6718eed01..45ea7e6d0 100644
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -45,6 +45,9 @@ using mozilla::services::GetObserverService;
static const char16_t kEllipsisChar[] = { 0x2026, 0x0 };
static const char16_t kASCIIPeriodsChar[] = { '.', '.', '.', 0x0 };
+const uint32_t kVariationSelector15 = 0xFE0E; // text presentation
+const uint32_t kVariationSelector16 = 0xFE0F; // emoji presentation
+
#ifdef DEBUG_roc
#define DEBUG_TEXT_RUN_STORAGE_METRICS
#endif
@@ -2813,7 +2816,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 +3084,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)) {