Commit 9f1a306d authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1728086 - Fix system-ui support on Linux distros where Gnome settings...

Bug 1728086 - Fix system-ui support on Linux distros where Gnome settings aren't mapped to fontconfig. r=jfkthame

Differential Revision: https://phabricator.services.mozilla.com/D124049
parent 71fdba4f
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -2219,8 +2219,6 @@ bool gfxFcPlatformFontList::GetStandardFamilyName(const nsCString& aFontName,
void gfxFcPlatformFontList::AddGenericFonts(
    StyleGenericFontFamily aGenericType, nsAtom* aLanguage,
    nsTArray<FamilyAndGeneric>& aFamilyList) {
  bool usePrefFontList = false;

  const char* generic = GetGenericName(aGenericType);
  NS_ASSERTION(generic, "weird generic font type");
  if (!generic) {
@@ -2229,7 +2227,11 @@ void gfxFcPlatformFontList::AddGenericFonts(

  // By default, most font prefs on Linux map to "use fontconfig"
  // keywords. So only need to explicitly lookup font pref if
  // non-default settings exist
  // non-default settings exist, or if we are the system-ui font, which we deal
  // with in the base class.
  const bool isSystemUi = aGenericType == StyleGenericFontFamily::SystemUi;
  bool usePrefFontList = isSystemUi;

  nsAutoCString genericToLookup(generic);
  if ((!mAlwaysUseFontconfigGenerics && aLanguage) ||
      aLanguage == nsGkAtoms::x_math) {
@@ -2262,8 +2264,10 @@ void gfxFcPlatformFontList::AddGenericFonts(

  // when pref fonts exist, use standard pref font lookup
  if (usePrefFontList) {
    return gfxPlatformFontList::AddGenericFonts(aGenericType, aLanguage,
                                                aFamilyList);
    gfxPlatformFontList::AddGenericFonts(aGenericType, aLanguage, aFamilyList);
    if (!isSystemUi) {
      return;
    }
  }

  PrefFontList* prefFonts = FindGenericFamilies(genericToLookup, aLanguage);