forked from mirrors/gecko-dev
Bug 1686274 - Put the activation of app-bundled fonts behind a pref on all platforms, with a default auto option that is Windows-version-sensitive. r=lsalzman
This allows us to default to skipping the bundled Twemoji Mozilla font when running on Win8.1 or later,
where we can assume Segoe UI Emoji is available.
The new pref here replaces the existing pair of boolean prefs that were only supported on Android,
and is now respected on all platforms. Available settings are:
0 disable use of app-bundled fonts
> 0 enable use of app-bundled fonts
< 0 default (auto): decide at startup, based on the system environment
(The pref is relevant only at startup; changing its value during a session will not make the bundled fonts
appear/disappear dynamically.)
Differential Revision: https://phabricator.services.mozilla.com/D102085
This commit is contained in:
parent
f85118ee44
commit
fa6b797928
8 changed files with 56 additions and 19 deletions
|
|
@ -15,7 +15,9 @@
|
|||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
|
@ -1487,7 +1489,13 @@ void gfxDWriteFontList::InitSharedFontListForPlatform() {
|
|||
return;
|
||||
}
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
mBundledFonts = CreateBundledFontsCollection(factory);
|
||||
// If the bundled-fonts pref is < 0 (auto), we skip the bundled fonts on
|
||||
// Windows 8.1 or later, where Segoe UI Emoji is available.
|
||||
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() > 0 ||
|
||||
(StaticPrefs::gfx_bundled_fonts_activate_AtStartup() < 0 &&
|
||||
!IsWin8Point1OrLater())) {
|
||||
mBundledFonts = CreateBundledFontsCollection(factory);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
|
|
@ -1569,7 +1577,13 @@ nsresult gfxDWriteFontList::InitFontListForPlatform() {
|
|||
// Get bundled fonts before the system collection, so that in the case of
|
||||
// duplicate names, we have recorded the family as bundled (and therefore
|
||||
// available regardless of visibility settings).
|
||||
mBundledFonts = CreateBundledFontsCollection(factory);
|
||||
// If the bundled-fonts pref is < 0 (auto), we skip the bundled fonts on
|
||||
// Windows 8.1 or later, where Segoe UI Emoji is available.
|
||||
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() > 0 ||
|
||||
(StaticPrefs::gfx_bundled_fonts_activate_AtStartup() < 0 &&
|
||||
!IsWin8Point1OrLater())) {
|
||||
mBundledFonts = CreateBundledFontsCollection(factory);
|
||||
}
|
||||
if (mBundledFonts) {
|
||||
GetFontsFromCollection(mBundledFonts);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1471,9 +1471,9 @@ void gfxFT2FontList::FindFonts() {
|
|||
// (Prefs may disable this, or force-enable it even with low memory.)
|
||||
bool lowmem;
|
||||
nsCOMPtr<nsIMemory> mem = nsMemory::GetGlobalMemoryService();
|
||||
if ((NS_SUCCEEDED(mem->IsLowMemoryPlatform(&lowmem)) && !lowmem &&
|
||||
Preferences::GetBool("gfx.bundled_fonts.enabled")) ||
|
||||
Preferences::GetBool("gfx.bundled_fonts.force-enabled")) {
|
||||
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() > 0 ||
|
||||
(StaticPrefs::gfx_bundled_fonts_activate_AtStartup() < 0 &&
|
||||
NS_SUCCEEDED(mem->IsLowMemoryPlatform(&lowmem)) && !lowmem)) {
|
||||
FindFontsInOmnijar(mFontNameCache.get());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
|
|
@ -1385,7 +1386,9 @@ void gfxFcPlatformFontList::AddPatternToFontList(
|
|||
|
||||
nsresult gfxFcPlatformFontList::InitFontListForPlatform() {
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
ActivateBundledFonts();
|
||||
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() != 0) {
|
||||
ActivateBundledFonts();
|
||||
}
|
||||
#endif
|
||||
|
||||
mLocalNames.Clear();
|
||||
|
|
@ -1473,8 +1476,10 @@ nsresult gfxFcPlatformFontList::InitFontListForPlatform() {
|
|||
AddFontSetFamilies(systemFonts, policy.get(), /* aAppFonts = */ false);
|
||||
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
FcFontSet* appFonts = FcConfigGetFonts(nullptr, FcSetApplication);
|
||||
AddFontSetFamilies(appFonts, policy.get(), /* aAppFonts = */ true);
|
||||
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() != 0) {
|
||||
FcFontSet* appFonts = FcConfigGetFonts(nullptr, FcSetApplication);
|
||||
AddFontSetFamilies(appFonts, policy.get(), /* aAppFonts = */ true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
|
|
@ -1531,7 +1536,9 @@ void gfxFcPlatformFontList::InitSharedFontListForPlatform() {
|
|||
}
|
||||
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
ActivateBundledFonts();
|
||||
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() != 0) {
|
||||
ActivateBundledFonts();
|
||||
}
|
||||
#endif
|
||||
|
||||
UniquePtr<SandboxPolicy> policy;
|
||||
|
|
@ -1698,8 +1705,10 @@ void gfxFcPlatformFontList::InitSharedFontListForPlatform() {
|
|||
addFontSetFamilies(systemFonts, policy.get(), /* aAppFonts = */ false);
|
||||
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
FcFontSet* appFonts = FcConfigGetFonts(nullptr, FcSetApplication);
|
||||
addFontSetFamilies(appFonts, policy.get(), /* aAppFonts = */ true);
|
||||
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() != 0) {
|
||||
FcFontSet* appFonts = FcConfigGetFonts(nullptr, FcSetApplication);
|
||||
addFontSetFamilies(appFonts, policy.get(), /* aAppFonts = */ true);
|
||||
}
|
||||
#endif
|
||||
|
||||
mozilla::fontlist::FontList* list = SharedFontList();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "GeckoProfiler.h"
|
||||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include <usp10.h>
|
||||
|
|
@ -513,7 +514,9 @@ void GDIFontFamily::FindStyleVariations(FontInfoData* aFontInfoData) {
|
|||
|
||||
gfxGDIFontList::gfxGDIFontList() : mFontSubstitutes(32) {
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
ActivateBundledFonts();
|
||||
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() != 0) {
|
||||
ActivateBundledFonts();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@
|
|||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
|
|
@ -815,7 +816,11 @@ gfxMacPlatformFontList::gfxMacPlatformFontList()
|
|||
CheckFamilyList(kBaseFonts, ArrayLength(kBaseFonts));
|
||||
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
ActivateBundledFonts();
|
||||
// We activate bundled fonts if the pref is > 0 (on) or < 0 (auto), only an
|
||||
// explicit value of 0 (off) will disable them.
|
||||
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() != 0) {
|
||||
ActivateBundledFonts();
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult rv;
|
||||
|
|
|
|||
|
|
@ -192,7 +192,8 @@ 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
|
||||
fuzzy-if(Android,0-128,0-233) == 1463020-letter-spacing-text-transform-1.html 1463020-letter-spacing-text-transform-1-ref.html
|
||||
# 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
|
||||
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
|
||||
|
|
|
|||
|
|
@ -4340,6 +4340,16 @@
|
|||
value: @IS_EARLY_BETA_OR_EARLIER@
|
||||
mirror: once
|
||||
|
||||
# Whether to load fonts (e.g. Twemoji Mozilla) bundled with the application:
|
||||
# -1 - Auto behavior based on OS version (currently, disables loading on Win8.1 or later,
|
||||
# or on "low-memory" Android devices)
|
||||
# 0 - Skip loading any bundled fonts
|
||||
# 1 - Always load bundled fonts
|
||||
- name: gfx.bundled-fonts.activate
|
||||
type: int32_t
|
||||
value: -1
|
||||
mirror: once
|
||||
|
||||
- name: gfx.font_loader.delay
|
||||
type: uint32_t
|
||||
#if defined(XP_WIN)
|
||||
|
|
|
|||
|
|
@ -589,11 +589,6 @@ pref("gfx.downloadable_fonts.fallback_delay_short", 100);
|
|||
// the uncached load behavior across pages (useful for testing reflow problems)
|
||||
pref("gfx.downloadable_fonts.disable_cache", false);
|
||||
|
||||
#ifdef ANDROID
|
||||
pref("gfx.bundled_fonts.enabled", true);
|
||||
pref("gfx.bundled_fonts.force-enabled", false);
|
||||
#endif
|
||||
|
||||
// Do we fire a notification about missing fonts, so the front-end can decide
|
||||
// whether to try and do something about it (e.g. download additional fonts)?
|
||||
pref("gfx.missing_fonts.notify", false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue