mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1619350 - patch 2 - Add lists of standard Mac and Windows fonts, and set font-family visibility attributes accordingly in those platform font lists. r=jwatt
These two platforms are the easiest to get started with - as well as accounting for the great majority of desktop Firefox users. This patch is based on the OS vendors' lists of fonts shipped with the current version of each OS. Differential Revision: https://phabricator.services.mozilla.com/D66125 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1e295dc3cc
commit
1ab7bd6878
181
gfx/thebes/StandardFonts-macos.inc
Normal file
181
gfx/thebes/StandardFonts-macos.inc
Normal file
@ -0,0 +1,181 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// List of standard font families installed as part of macOS 10.15 "Catalina"
|
||||
// from https://developer.apple.com/fonts/system-fonts/
|
||||
static const char* kBaseFonts[] = {
|
||||
"Al Bayan",
|
||||
"Al Nile",
|
||||
"Al Tarikh",
|
||||
"American Typewriter",
|
||||
"Andale Mono",
|
||||
"Apple Braille",
|
||||
"Apple Chancery",
|
||||
"Apple Color Emoji",
|
||||
"Apple SD Gothic Neo",
|
||||
"Apple Symbols",
|
||||
"AppleGothic",
|
||||
"AppleMyungjo",
|
||||
"Arial",
|
||||
"Arial Black",
|
||||
"Arial Hebrew",
|
||||
"Arial Hebrew Scholar",
|
||||
"Arial Narrow",
|
||||
"Arial Rounded MT Bold",
|
||||
"Arial Unicode MS",
|
||||
"Avenir",
|
||||
"Avenir Next",
|
||||
"Ayuthaya",
|
||||
"Baghdad",
|
||||
"Bangla MN",
|
||||
"Bangla Sangam MN",
|
||||
"Baskerville",
|
||||
"Bodoni 72",
|
||||
"Bodoni 72 Oldstyle",
|
||||
"Bodoni 72 Smallcaps",
|
||||
"Bodoni Ornaments",
|
||||
"Bradley Hand",
|
||||
"Brush Script MT",
|
||||
"Chalkboard",
|
||||
"Chalkboard SE",
|
||||
"Chalkduster",
|
||||
"Charter",
|
||||
"Cochin",
|
||||
"Copperplate",
|
||||
"Corsiva Hebrew",
|
||||
"Courier",
|
||||
"Courier New",
|
||||
"Damascus",
|
||||
"DecoType Naskh",
|
||||
"Devanagari MT",
|
||||
"Devanagari Sangam MN",
|
||||
"Didot",
|
||||
"DIN Alternate",
|
||||
"DIN Condensed",
|
||||
"Diwan Kufi",
|
||||
"Diwan Thuluth",
|
||||
"Euphemia UCAS",
|
||||
"Farah",
|
||||
"Farisi",
|
||||
"Futura",
|
||||
"GB18030 Bitmap",
|
||||
"Geeza Pro",
|
||||
"Geneva",
|
||||
"Georgia",
|
||||
"Gill Sans",
|
||||
"Gujarati MT",
|
||||
"Gujarati Sangam MN",
|
||||
"Gurmukhi MN",
|
||||
"Gurmukhi MT",
|
||||
"Gurmukhi Sangam MN",
|
||||
"Heiti SC",
|
||||
"Heiti TC",
|
||||
"Helvetica",
|
||||
"Helvetica Neue",
|
||||
"Hiragino Maru Gothic ProN",
|
||||
"Hiragino Mincho ProN",
|
||||
"Hiragino Sans",
|
||||
"Hiragino Sans GB",
|
||||
"Hoefler Text",
|
||||
"Impact",
|
||||
"InaiMathi",
|
||||
"ITF Devanagari",
|
||||
"ITF Devanagari Marathi",
|
||||
"Kailasa",
|
||||
"Kannada MN",
|
||||
"Kannada Sangam MN",
|
||||
"Kefa",
|
||||
"Khmer MN",
|
||||
"Khmer Sangam MN",
|
||||
"Kohinoor Bangla",
|
||||
"Kohinoor Devanagari",
|
||||
"Kohinoor Telugu",
|
||||
"Kokonor",
|
||||
"Krungthep",
|
||||
"KufiStandardGK",
|
||||
"Lao MN",
|
||||
"Lao Sangam MN",
|
||||
"Lucida Grande",
|
||||
"Luminari",
|
||||
"Malayalam MN",
|
||||
"Malayalam Sangam MN",
|
||||
"Marker Felt",
|
||||
"Menlo",
|
||||
"Microsoft Sans Serif",
|
||||
"Mishafi",
|
||||
"Mishafi Gold",
|
||||
"Monaco",
|
||||
"Mshtakan",
|
||||
"Muna",
|
||||
"Myanmar MN",
|
||||
"Myanmar Sangam MN",
|
||||
"Nadeem Regular",
|
||||
"New Peninim MT",
|
||||
"Noteworthy",
|
||||
"Noto Nastaliq Urdu",
|
||||
"Optima",
|
||||
"Oriya MN",
|
||||
"Oriya Sangam MN",
|
||||
"Palatino",
|
||||
"Papyrus",
|
||||
"Phosphate",
|
||||
"PingFang HK",
|
||||
"PingFang SC",
|
||||
"PingFang TC",
|
||||
"Plantagenet Cherokee",
|
||||
"PT Mono",
|
||||
"PT Sans",
|
||||
"PT Sans Caption",
|
||||
"PT Sans Narrow",
|
||||
"PT Serif",
|
||||
"PT Serif Caption",
|
||||
"Raanana",
|
||||
"Rockwell",
|
||||
"Sana",
|
||||
"Sathu",
|
||||
"Savoye LET",
|
||||
"Shree Devanagari 714",
|
||||
"SignPainter",
|
||||
"Silom",
|
||||
"Sinhala MN",
|
||||
"Sinhala Sangam MN",
|
||||
"Skia",
|
||||
"Snell Roundhand",
|
||||
"Songti SC",
|
||||
"Songti TC",
|
||||
"STIXGeneral",
|
||||
"STIXIntegralsD",
|
||||
"STIXIntegralsSm",
|
||||
"STIXIntegralsUp",
|
||||
"STIXIntegralsUpD",
|
||||
"STIXIntegralsUpSm",
|
||||
"STIXNonUnicode",
|
||||
"STIXSizeFiveSym",
|
||||
"STIXSizeFourSym",
|
||||
"STIXSizeOneSym",
|
||||
"STIXSizeThreeSym",
|
||||
"STIXSizeTwoSym",
|
||||
"STIXVariants",
|
||||
"STSong",
|
||||
"Sukhumvit Set",
|
||||
"Symbol",
|
||||
"Tahoma",
|
||||
"Tamil MN",
|
||||
"Tamil Sangam MN",
|
||||
"Telugu MN",
|
||||
"Telugu Sangam MN",
|
||||
"Thonburi",
|
||||
"Times",
|
||||
"Times New Roman",
|
||||
"Trattatello",
|
||||
"Trebuchet MS",
|
||||
"Verdana",
|
||||
"Waseem",
|
||||
"Webdings",
|
||||
"Wingdings",
|
||||
"Wingdings 2",
|
||||
"Wingdings 3",
|
||||
"Zapf Dingbats",
|
||||
"Zapfino",
|
||||
};
|
201
gfx/thebes/StandardFonts-win10.inc
Normal file
201
gfx/thebes/StandardFonts-win10.inc
Normal file
@ -0,0 +1,201 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// List of standard font families installed as part of Windows 10
|
||||
// from https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list
|
||||
// TODO: check whether we need to list legacy styled family names like "... Light".
|
||||
static const char* kBaseFonts[] = {
|
||||
"AlternateGothic2 BT",
|
||||
"Arial",
|
||||
"Arial Black",
|
||||
"Bahnschrift",
|
||||
"Bahnschrift Light",
|
||||
"Bahnschrift SemiBold",
|
||||
"Bahnschrift SemiLight",
|
||||
"Calibri",
|
||||
"Calibri Light",
|
||||
"Cambria",
|
||||
"Cambria Math",
|
||||
"Candara",
|
||||
"Comic Sans MS",
|
||||
"Consolas",
|
||||
"Constantia",
|
||||
"Corbel",
|
||||
"Courier New",
|
||||
"Ebrima",
|
||||
"Franklin Gothic Medium",
|
||||
"Gabriola",
|
||||
"Gadugi",
|
||||
"Georgia",
|
||||
"HoloLens MDL2 Assets",
|
||||
"Impact",
|
||||
"Javanese Text",
|
||||
"Leelawadee UI",
|
||||
"Leelawadee UI Semilight",
|
||||
"Lucida Console",
|
||||
"Lucida Sans Unicode",
|
||||
"Malgun Gothic",
|
||||
"Malgun Gothic Semilight",
|
||||
"Marlett",
|
||||
"Microsoft Himalaya",
|
||||
"Microsoft JhengHei",
|
||||
"Microsoft JhengHei Light",
|
||||
"Microsoft JhengHei UI",
|
||||
"Microsoft JhengHei UI Light",
|
||||
"Microsoft New Tai Lue",
|
||||
"Microsoft PhagsPa",
|
||||
"Microsoft Sans Serif",
|
||||
"Microsoft Tai Le",
|
||||
"Microsoft YaHei",
|
||||
"Microsoft YaHei Light",
|
||||
"Microsoft YaHei UI",
|
||||
"Microsoft YaHei UI Light",
|
||||
"Microsoft Yi Baiti",
|
||||
"MingLiU_HKSCS-ExtB",
|
||||
"MingLiU-ExtB",
|
||||
"Mongolian Baiti",
|
||||
"MS Gothic",
|
||||
"MS PGothic",
|
||||
"MS UI Gothic",
|
||||
"MV Boli",
|
||||
"Myanmar Text",
|
||||
"Nirmala UI",
|
||||
"Nirmala UI Semilight",
|
||||
"NSimSun",
|
||||
"Palatino Linotype",
|
||||
"PMingLiU-ExtB",
|
||||
"Segoe MDL2 Assets",
|
||||
"Segoe Print",
|
||||
"Segoe Script",
|
||||
"Segoe UI",
|
||||
"Segoe UI Black",
|
||||
"Segoe UI Emoji",
|
||||
"Segoe UI Historic",
|
||||
"Segoe UI Light",
|
||||
"Segoe UI Semibold",
|
||||
"Segoe UI Semilight",
|
||||
"Segoe UI Symbol",
|
||||
"SimSun",
|
||||
"SimSun-ExtB",
|
||||
"Sitka Banner",
|
||||
"Sitka Display",
|
||||
"Sitka Heading",
|
||||
"Sitka Small",
|
||||
"Sitka Subheading",
|
||||
"Sitka Text",
|
||||
"Sylfaen",
|
||||
"Symbol",
|
||||
"Tahoma",
|
||||
"Times New Roman",
|
||||
"Trebuchet MS",
|
||||
"Verdana",
|
||||
"Webdings",
|
||||
"Wingdings",
|
||||
"Yu Gothic",
|
||||
"Yu Gothic Light",
|
||||
"Yu Gothic Medium",
|
||||
"Yu Gothic UI",
|
||||
"Yu Gothic UI Light",
|
||||
"Yu Gothic UI Semibold",
|
||||
"Yu Gothic UI Semilight",
|
||||
};
|
||||
|
||||
// Additional fonts provided by language-pack installation.
|
||||
static const char* kLangPackFonts[] = {
|
||||
"Aharoni Bold", // Hebrew Supplemental Fonts
|
||||
"Aldhabi", // Arabic Script Supplemental Fonts
|
||||
"Andalus", // Arabic Script Supplemental Fonts
|
||||
"Angsana New", // Thai Supplemental Fonts
|
||||
"AngsanaUPC", // Thai Supplemental Fonts
|
||||
"Aparajita", // Devanagari Supplemental Fonts
|
||||
"Arabic Typesetting", // Arabic Script Supplemental Fonts
|
||||
"Batang", // Korean Supplemental Fonts
|
||||
"BatangChe", // Korean Supplemental Fonts
|
||||
"BIZ UDGothic", // Japanese Supplemental Fonts
|
||||
"BIZ UDMincho", // Japanese Supplemental Fonts
|
||||
"BIZ UDPGothic", // Japanese Supplemental Fonts
|
||||
"BIZ UDPMincho", // Japanese Supplemental Fonts
|
||||
"Browallia New", // Thai Supplemental Fonts
|
||||
"BrowalliaUPC", // Thai Supplemental Fonts
|
||||
"Cordia New", // Thai Supplemental Fonts
|
||||
"CordiaUPC", // Thai Supplemental Fonts
|
||||
"DaunPenh", // Khmer Supplemental Fonts
|
||||
"David", // Hebrew Supplemental Fonts
|
||||
"DengXian", // Chinese (Simplified) Supplemental Fonts
|
||||
"DFKai-SB", // Chinese (Traditional) Supplemental Fonts
|
||||
"DilleniaUPC", // Thai Supplemental Fonts
|
||||
"DokChampa", // Lao Supplemental Fonts
|
||||
"Dotum", // Korean Supplemental Fonts
|
||||
"DotumChe", // Korean Supplemental Fonts
|
||||
"Estrangelo Edessa", // Syriac Supplemental Fonts
|
||||
"EucrosiaUPC", // Thai Supplemental Fonts
|
||||
"Euphemia", // Canadian Aboriginal Syllabics Supplemental Fonts
|
||||
"FangSong", // Chinese (Simplified) Supplemental Fonts
|
||||
"FrankRuehl", // Hebrew Supplemental Fonts
|
||||
"FreesiaUPC", // Thai Supplemental Fonts
|
||||
"Gautami", // Telugu Supplemental Fonts
|
||||
"Gisha", // Hebrew Supplemental Fonts
|
||||
"Gulim", // Korean Supplemental Fonts
|
||||
"GulimChe", // Korean Supplemental Fonts
|
||||
"Gungsuh", // Korean Supplemental Fonts
|
||||
"GungsuhChe", // Korean Supplemental Fonts
|
||||
"IrisUPC", // Thai Supplemental Fonts
|
||||
"Iskoola Pota", // Sinhala Supplemental Fonts
|
||||
"JasmineUPC", // Thai Supplemental Fonts
|
||||
"KaiTi", // Chinese (Simplified) Supplemental Fonts
|
||||
"Kalinga", // Odia Supplemental Fonts
|
||||
"Kartika", // Malayalam Supplemental Fonts
|
||||
"Khmer UI", // Khmer Supplemental Fonts
|
||||
"KodchiangUPC", // Thai Supplemental Fonts
|
||||
"Kokila", // Devanagari Supplemental Fonts
|
||||
"Lao UI", // Lao Supplemental Fonts
|
||||
"Latha", // Tamil Supplemental Fonts
|
||||
"Leelawadee", // Thai Supplemental Fonts
|
||||
"Levenim MT", // Hebrew Supplemental Fonts
|
||||
"LilyUPC", // Thai Supplemental Fonts
|
||||
"Mangal", // Devanagari Supplemental Fonts
|
||||
"Meiryo UI", // Japanese Supplemental Fonts
|
||||
"Meiryo", // Japanese Supplemental Fonts
|
||||
"Microsoft Uighur", // Arabic Script Supplemental Fonts
|
||||
"MingLiU_HKSCS", // Chinese (Traditional) Supplemental Fonts
|
||||
"MingLiU", // Chinese (Traditional) Supplemental Fonts
|
||||
"Miriam", // Hebrew Supplemental Fonts
|
||||
"MoolBoran", // Khmer Supplemental Fonts
|
||||
"MS Mincho", // Japanese Supplemental Fonts
|
||||
"MS PMincho", // Japanese Supplemental Fonts
|
||||
"Narkisim", // Hebrew Supplemental Fonts
|
||||
"Nyala", // Ethiopic Supplemental Fonts
|
||||
"Plantagenet Cherokee", // Cherokee Supplemental Fonts
|
||||
"PMingLiU", // Chinese (Traditional) Supplemental Fonts
|
||||
"Raavi", // Gurmukhi Supplemental Fonts
|
||||
"Rod", // Hebrew Supplemental Fonts
|
||||
"Sakkal Majalla", // Arabic Script Supplemental Fonts
|
||||
"Sanskrit Text", // Devanagari Supplemental Fonts
|
||||
"Shonar Bangla", // Bangla Script Supplemental Fonts
|
||||
"Shruti", // Gujarati Supplemental Fonts
|
||||
"SimHei", // Chinese (Simplified) Supplemental Fonts
|
||||
"Simplified Arabic", // Arabic Script Supplemental Fonts
|
||||
"Traditional Arabic", // Arabic Script Supplemental Fonts
|
||||
"Tunga", // Kannada Supplemental Fonts
|
||||
"UD Digi Kyokasho N-R", // Japanese Supplemental Fonts
|
||||
"UD Digi Kyokasho NK-B", // Japanese Supplemental Fonts
|
||||
"UD Digi Kyokasho NK-R", // Japanese Supplemental Fonts
|
||||
"UD Digi Kyokasho NP-B", // Japanese Supplemental Fonts
|
||||
"UD Digi Kyokasho NP-R", // Japanese Supplemental Fonts
|
||||
"UD Digi Kyokasho", // Japanese Supplemental Fonts
|
||||
"Urdu Typesetting", // Arabic Script Supplemental Fonts
|
||||
"Utsaah", // Devanagari Supplemental Fonts
|
||||
"Vani", // Telugu Supplemental Fonts
|
||||
"Vijaya", // Tamil Supplemental Fonts
|
||||
"Vrinda", // Bangla Script Supplemental Fonts
|
||||
"Yu Mincho", // Japanese Supplemental Fonts
|
||||
// Latin/Greek/Cyrillic scripts are already well-supported by the base fonts,
|
||||
// so we do not include these even when the LangPack collection is enabled.
|
||||
// "Arial Nova", // Pan-European Supplemental Fonts - EXCLUDED
|
||||
// "Georgia Pro", // Pan-European Supplemental Fonts - EXCLUDED
|
||||
// "Gill Sans Nova", // Pan-European Supplemental Fonts - EXCLUDED
|
||||
// "Neue Haas Grotesk Text Pro", // Pan-European Supplemental Fonts - EXCLUDED
|
||||
// "Rockwell Nova", // Pan-European Supplemental Fonts - EXCLUDED
|
||||
// "Verdana Pro", // Pan-European Supplemental Fonts - EXCLUDED
|
||||
};
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include "harfbuzz/hb.h"
|
||||
|
||||
#include "StandardFonts-win10.inc"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using mozilla::intl::OSPreferences;
|
||||
@ -992,6 +994,17 @@ gfxFontEntry* gfxDWriteFontList::CreateFontEntry(
|
||||
return fe;
|
||||
}
|
||||
|
||||
FontVisibility gfxDWriteFontList::GetVisibilityForFamily(
|
||||
const nsACString& aName) const {
|
||||
if (FamilyInList(aName, kBaseFonts, ArrayLength(kBaseFonts))) {
|
||||
return FontVisibility::Base;
|
||||
}
|
||||
if (FamilyInList(aName, kLangPackFonts, ArrayLength(kLangPackFonts))) {
|
||||
return FontVisibility::Base;
|
||||
}
|
||||
return FontVisibility::User;
|
||||
}
|
||||
|
||||
void gfxDWriteFontList::AppendFamiliesFromCollection(
|
||||
IDWriteFontCollection* aCollection,
|
||||
nsTArray<fontlist::Family::InitData>& aFamilies,
|
||||
@ -1012,7 +1025,7 @@ void gfxDWriteFontList::AppendFamiliesFromCollection(
|
||||
BuildKeyNameFromFontName(key);
|
||||
bool bad = mBadUnderlineFamilyNames.ContainsSorted(key);
|
||||
bool classic = aForceClassicFams && aForceClassicFams->ContainsSorted(key);
|
||||
FontVisibility visibility = FontVisibility::Unknown; // TODO
|
||||
FontVisibility visibility = GetVisibilityForFamily(name);
|
||||
aFamilies.AppendElement(fontlist::Family::InitData(
|
||||
key, name, i, visibility, aCollection != mSystemFonts, bad, classic));
|
||||
}
|
||||
@ -1504,7 +1517,7 @@ void gfxDWriteFontList::GetFontsFromCollection(
|
||||
continue;
|
||||
}
|
||||
|
||||
FontVisibility visibility = FontVisibility::Unknown; // TODO
|
||||
FontVisibility visibility = GetVisibilityForFamily(familyName);
|
||||
|
||||
fam = new gfxDWriteFontFamily(familyName, visibility, family,
|
||||
aCollection == mSystemFonts);
|
||||
|
@ -370,6 +370,8 @@ class gfxDWriteFontList final : public gfxPlatformFontList {
|
||||
nsresult InitFontListForPlatform() override;
|
||||
void InitSharedFontListForPlatform() override;
|
||||
|
||||
FontVisibility GetVisibilityForFamily(const nsACString& aName) const;
|
||||
|
||||
gfxFontFamily* CreateFontFamily(const nsACString& aName,
|
||||
FontVisibility aVisibility) const override;
|
||||
|
||||
|
@ -173,6 +173,8 @@ class gfxMacPlatformFontList final : public gfxPlatformFontList {
|
||||
// helper function to lookup in both hidden system fonts and normal fonts
|
||||
gfxFontFamily* FindSystemFontFamily(const nsACString& aFamily);
|
||||
|
||||
FontVisibility GetVisibilityForFamily(const nsACString& aName) const;
|
||||
|
||||
static void RegisteredFontsChangedNotificationCallback(
|
||||
CFNotificationCenterRef center, void* observer, CFStringRef name,
|
||||
const void* object, CFDictionaryRef userInfo);
|
||||
|
@ -77,6 +77,8 @@
|
||||
#include <time.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "StandardFonts-macos.inc"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
@ -855,6 +857,16 @@ void gfxMacPlatformFontList::AddFamily(const nsACString& aFamilyName, FontVisibi
|
||||
}
|
||||
}
|
||||
|
||||
FontVisibility gfxMacPlatformFontList::GetVisibilityForFamily(const nsACString& aName) const {
|
||||
if (aName[0] == '.' || aName.LowerCaseEqualsLiteral("lastresort")) {
|
||||
return FontVisibility::Hidden;
|
||||
}
|
||||
if (FamilyInList(aName, kBaseFonts, ArrayLength(kBaseFonts))) {
|
||||
return FontVisibility::Base;
|
||||
}
|
||||
return FontVisibility::User;
|
||||
}
|
||||
|
||||
void gfxMacPlatformFontList::AddFamily(CFStringRef aFamily) {
|
||||
NSString* family = (NSString*)aFamily;
|
||||
|
||||
@ -868,8 +880,8 @@ void gfxMacPlatformFontList::AddFamily(CFStringRef aFamily) {
|
||||
nsAutoString familyName;
|
||||
nsCocoaUtils::GetStringForNSString(family, familyName);
|
||||
|
||||
FontVisibility visibility = familyName[0] == '.' ? FontVisibility::Hidden : FontVisibility::Unknown;
|
||||
AddFamily(NS_ConvertUTF16toUTF8(familyName), visibility);
|
||||
NS_ConvertUTF16toUTF8 nameUtf8(familyName);
|
||||
AddFamily(nameUtf8, GetVisibilityForFamily(nameUtf8));
|
||||
}
|
||||
|
||||
void gfxMacPlatformFontList::ReadSystemFontList(nsTArray<FontFamilyListEntry>* aList) {
|
||||
@ -955,10 +967,8 @@ void gfxMacPlatformFontList::InitSharedFontListForPlatform() {
|
||||
NS_ConvertUTF16toUTF8 name(name16);
|
||||
nsAutoCString key;
|
||||
GenerateFontListKey(name, key);
|
||||
FontVisibility visibility = key.EqualsLiteral("lastresort") || key[0] == '.'
|
||||
? FontVisibility::Hidden
|
||||
: FontVisibility::Unknown;
|
||||
families.AppendElement(fontlist::Family::InitData(key, name, 0, visibility));
|
||||
families.AppendElement(
|
||||
fontlist::Family::InitData(key, name, 0, GetVisibilityForFamily(name)));
|
||||
}
|
||||
CFRelease(familyNames);
|
||||
ApplyWhitelist(families);
|
||||
|
@ -379,6 +379,16 @@ void gfxPlatformFontList::ApplyWhitelist(
|
||||
aFamilies = accepted;
|
||||
}
|
||||
|
||||
bool gfxPlatformFontList::FamilyInList(const nsACString& aName,
|
||||
const char* aList[], size_t aCount) {
|
||||
auto cmp = [&](const char* const aVal) -> int {
|
||||
nsCaseInsensitiveUTF8StringComparator cmp;
|
||||
return cmp(aName.BeginReading(), aVal, aName.Length(), strlen(aVal));
|
||||
};
|
||||
size_t result;
|
||||
return BinarySearchIf(aList, 0, aCount, cmp, &result);
|
||||
}
|
||||
|
||||
bool gfxPlatformFontList::AddWithLegacyFamilyName(const nsACString& aLegacyName,
|
||||
gfxFontEntry* aFontEntry,
|
||||
FontVisibility aVisibility) {
|
||||
|
@ -459,6 +459,9 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
||||
friend class mozilla::fontlist::FontList;
|
||||
friend class InitOtherFamilyNamesForStylo;
|
||||
|
||||
static bool FamilyInList(const nsACString& aName, const char* aList[],
|
||||
size_t aCount);
|
||||
|
||||
class InitOtherFamilyNamesRunnable : public mozilla::CancelableRunnable {
|
||||
public:
|
||||
InitOtherFamilyNamesRunnable()
|
||||
|
Loading…
Reference in New Issue
Block a user