Bug 1692498 - Let the emoji font pref override Unicode presentation style only if it's explicitly user-set. r=emk

Differential Revision: https://phabricator.services.mozilla.com/D105102
This commit is contained in:
Jonathan Kew 2021-02-16 10:06:10 +00:00
parent 104874c6e2
commit 4a675c2c2f
5 changed files with 12 additions and 16 deletions

View File

@ -3329,12 +3329,14 @@ gfxFont* gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh,
// 2. search pref fonts
gfxFont* font = WhichPrefFontSupportsChar(aCh, aNextCh, presentation);
if (font) {
if (PrefersColor(presentation)) {
// For emoji, always accept the font from preferences even if it isn't
// actually a color-emoji font, as some users may explicitly choose to
// set their emoji font preference to a monochrome font like Symbola.
// So the font.name-list.emoji preference takes precedence over the
// Unicode presentation style here.
if (PrefersColor(presentation) &&
Preferences::HasUserValue("font.name-list.emoji")) {
// For emoji, always accept the font from preferences if it's explicitly
// user-set, even if it isn't actually a color-emoji font, as some users
// may want to set their emoji font preference to a monochrome font like
// Symbola.
// So a user-provided font.name-list.emoji preference takes precedence
// over the Unicode presentation style here.
RefPtr<gfxFont> autoRefDeref(candidateFont);
*aMatchType = FontMatchType::Kind::kPrefsFallback;
return font;

View File

@ -3,10 +3,6 @@
<meta charset=utf-8>
<style>
span {
/* On Windows, we need to use the TwEmoji Mozilla font in preference to
Segoe UI Emoji, as the latter doesn't support the Regional-Indicator
flag ligatures. */
font-family: TwEmoji Mozilla, sans-serif;
font-size: 36px;
font-kerning: none;
}

View File

@ -3,10 +3,6 @@
<meta charset=utf-8>
<style>
span {
/* On Windows, we need to use the TwEmoji Mozilla font in preference to
Segoe UI Emoji, as the latter doesn't support the Regional-Indicator
flag ligatures. */
font-family: TwEmoji Mozilla, sans-serif;
font-size: 36px;
font-kerning: none;
}

View File

@ -192,8 +192,7 @@ random-if(!winWidget) == arial-bold-lam-alef-1.html arial-bold-lam-alef-1-ref.ht
fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 1320665-cmap-format-13.html 1320665-cmap-format-13-ref.html # see bug 1320665 comments 8-9
== 1331339-script-extensions-shaping-1.html 1331339-script-extensions-shaping-1-ref.html
skip-if(!cocoaWidget) != 1349308-1.html 1349308-notref.html # macOS-specific test for -apple-system glyph metrics
# 1463020-letter-spacing-text-transform-1 fails on Win10 because Segoe UI Emoji doesn't ligate regional-indicator characters to form flag symbols
fails-if(/^^Windows\x20NT\x2010\.0/.test(http.oscpu)) fuzzy-if(Android,0-128,0-233) == 1463020-letter-spacing-text-transform-1.html 1463020-letter-spacing-text-transform-1-ref.html
fuzzy-if(Android,0-128,0-233) == 1463020-letter-spacing-text-transform-1.html 1463020-letter-spacing-text-transform-1-ref.html
fails-if(Android) == 1463020-letter-spacing-text-transform-2.html 1463020-letter-spacing-text-transform-2-ref.html # missing font coverage on Android
== 1507661-spurious-hyphenation-after-explicit.html 1507661-spurious-hyphenation-after-explicit-ref.html
fuzzy-if(!webrender,12-66,288-1681) fails-if(gtkWidget&&!webrender) == 1522857-1.html 1522857-1-ref.html # antialiasing fuzz in non-webrender cases

View File

@ -443,6 +443,9 @@ class RefTest(object):
# mid-test, the extra reflow that is triggered can disrupt the test.
prefs["gfx.font_loader.delay"] = 0
prefs["gfx.font_loader.interval"] = 0
# Ensure bundled fonts are activated, even if not enabled by default
# on the platform, so that tests can rely on them.
prefs["gfx.bundled-fonts.activate"] = 1
# Disable dark scrollbars because it's semi-transparent.
prefs["widget.disable-dark-scrollbar"] = True
prefs["reftest.isCoverageBuild"] = mozinfo.info.get("ccov", False)