Bug 1866965 - Add list of standard fonts for Fedora 38. r=emilio

Fedora 38 is still supported since Fedora supports the previous release
in addition to the current one. I added a font list for Fedora 38 and
code to detect the version.

Depends on D197229

Differential Revision: https://phabricator.services.mozilla.com/D197230
This commit is contained in:
Alexander Zhang
2023-12-24 14:08:33 +00:00
parent cfd2215535
commit 12fcf50d0b
3 changed files with 81 additions and 3 deletions

View File

@@ -1005,3 +1005,61 @@ static const char* kBaseFonts_Fedora_39[] = {
"ആർഐടി രചന",
"രചന",
};
// List of standard font families installed on Fedora 38 Workstation.
static const char* kBaseFonts_Fedora_38[] = {
"Cantarell",
"Jomolhari",
"Liberation Mono",
"Liberation Sans",
"Liberation Serif",
"Lohit Assamese",
"Lohit Bengali",
"Lohit Devanagari",
"Lohit Gujarati",
"Lohit Kannada",
"Lohit Marathi",
"Lohit Odia",
"Lohit Tamil",
"Lohit Telugu",
"Mingzat",
"Noto Color Emoji",
"Noto Naskh Arabic",
"Noto Sans",
"Noto Sans Arabic",
"Noto Sans Armenian",
"Noto Sans Canadian Aboriginal",
"Noto Sans Cherokee",
"Noto Sans CJK HK",
"Noto Sans CJK JP",
"Noto Sans CJK KR",
"Noto Sans CJK SC",
"Noto Sans CJK TC",
"Noto Sans Ethiopic",
"Noto Sans Georgian",
"Noto Sans Gurmukhi",
"Noto Sans Hebrew",
"Noto Sans Khmer",
"Noto Sans Lao",
"Noto Sans Math",
"Noto Sans Mono",
"Noto Sans Mono CJK HK",
"Noto Sans Mono CJK JP",
"Noto Sans Mono CJK KR",
"Noto Sans Mono CJK SC",
"Noto Sans Mono CJK TC",
"Noto Sans Sinhala",
"Noto Sans Thaana",
"Noto Sans Thai",
"Noto Serif",
"Nuosu SIL",
"Padauk",
"PakType Naskh Basic",
"RIT Meera New",
"STIX",
"STIX Two Math",
"STIX Two Text",
"STIX Two Text Medium",
"STIX Two Text SemiBold",
"Vazirmatn",
};

View File

@@ -1359,6 +1359,7 @@ gfxFcPlatformFontList::gfxFcPlatformFontList()
CheckFamilyList(kBaseFonts_Ubuntu_20_04);
CheckFamilyList(kLangFonts_Ubuntu_20_04);
CheckFamilyList(kBaseFonts_Fedora_39);
CheckFamilyList(kBaseFonts_Fedora_38);
mLastConfig = FcConfigGetCurrent();
if (XRE_IsParentProcess()) {
// if the rescan interval is set, start the timer
@@ -1999,7 +2000,7 @@ gfxFcPlatformFontList::DistroID gfxFcPlatformFontList::GetDistroID() const {
if (strncmp(buf + 3, "ubuntu", 6) == 0) {
result = DistroID::Ubuntu_any;
} else if (strncmp(buf + 3, "fedora", 6) == 0) {
result = DistroID::Fedora;
result = DistroID::Fedora_any;
}
if (versionMajor) {
break;
@@ -2014,6 +2015,12 @@ gfxFcPlatformFontList::DistroID gfxFcPlatformFontList::GetDistroID() const {
} else if (versionMajor == 22) {
result = DistroID::Ubuntu_22;
}
} else if (result == DistroID::Fedora_any) {
if (versionMajor == 38) {
result = DistroID::Fedora_38;
} else if (versionMajor == 39) {
result = DistroID::Fedora_39;
}
}
return result;
};
@@ -2048,10 +2055,21 @@ FontVisibility gfxFcPlatformFontList::GetVisibilityForFamily(
}
return FontVisibility::User;
case DistroID::Fedora:
case DistroID::Fedora_any:
case DistroID::Fedora_39:
if (FamilyInList(aName, kBaseFonts_Fedora_39)) {
return FontVisibility::Base;
}
if (distro == DistroID::Fedora_39) {
return FontVisibility::User;
}
// For Fedora_any, fall through to also check Fedora 38 list.
[[fallthrough]];
case DistroID::Fedora_38:
if (FamilyInList(aName, kBaseFonts_Fedora_38)) {
return FontVisibility::Base;
}
return FontVisibility::User;
default:

View File

@@ -356,7 +356,9 @@ class gfxFcPlatformFontList final : public gfxPlatformFontList {
Ubuntu_any,
Ubuntu_20,
Ubuntu_22,
Fedora,
Fedora_any,
Fedora_38,
Fedora_39,
// To be extended with any distros that ship a useful base set of fonts
// that we want to explicitly support.
};