Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 4c2a389

Browse files
committed
Bug 1690877 - Only activate additional fonts in the parent process on macOS. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D104559
1 parent f4213fb commit 4c2a389

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

gfx/thebes/gfxMacPlatformFontList.mm

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -822,28 +822,30 @@ explicit gfxSingleFaceMacFontFamily(const nsACString& aName)
822822
: gfxPlatformFontList(false), mDefaultFont(nullptr), mUseSizeSensitiveSystemFont(false) {
823823
CheckFamilyList(kBaseFonts, ArrayLength(kBaseFonts));
824824

825+
// It appears to be sufficient to activate fonts in the parent process;
826+
// they are then also usable in child processes.
827+
// Likewise, only the parent process listens for OS font-changed notifications;
828+
// after rebuilding its list, it will update the content processes.
829+
if (XRE_IsParentProcess()) {
825830
#ifdef MOZ_BUNDLED_FONTS
826-
// We activate bundled fonts if the pref is > 0 (on) or < 0 (auto), only an
827-
// explicit value of 0 (off) will disable them.
828-
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() != 0) {
829-
ActivateBundledFonts();
830-
}
831+
// We activate bundled fonts if the pref is > 0 (on) or < 0 (auto), only an
832+
// explicit value of 0 (off) will disable them.
833+
if (StaticPrefs::gfx_bundled_fonts_activate_AtStartup() != 0) {
834+
ActivateBundledFonts();
835+
}
831836
#endif
832837

833-
for (const auto& dir : kLangFontsDirs) {
834-
nsresult rv;
835-
nsCOMPtr<nsIFile> langFonts(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
836-
if (NS_SUCCEEDED(rv)) {
837-
rv = langFonts->InitWithNativePath(dir);
838+
for (const auto& dir : kLangFontsDirs) {
839+
nsresult rv;
840+
nsCOMPtr<nsIFile> langFonts(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
838841
if (NS_SUCCEEDED(rv)) {
839-
ActivateFontsFromDir(langFonts);
842+
rv = langFonts->InitWithNativePath(dir);
843+
if (NS_SUCCEEDED(rv)) {
844+
ActivateFontsFromDir(langFonts);
845+
}
840846
}
841847
}
842-
}
843848

844-
// Only the parent process listens for OS font-changed notifications;
845-
// after rebuilding its list, it will update the content processes.
846-
if (XRE_IsParentProcess()) {
847849
::CFNotificationCenterAddObserver(::CFNotificationCenterGetLocalCenter(), this,
848850
RegisteredFontsChangedNotificationCallback,
849851
kCTFontManagerRegisteredFontsChangedNotification, 0,

0 commit comments

Comments
 (0)