refactor: ponytail audit

This commit is contained in:
Amruth Pillai
2026-07-27 20:26:16 +02:00
parent bb1fb3a7d6
commit 9110e86997
157 changed files with 1082 additions and 2177 deletions
+4 -12
View File
@@ -91,13 +91,9 @@ export const standardFontList = standardPdfFontList.filter((font) => !webFontMap
const fontMap = new Map<string, FontRecord>();
const chinesePrioritySet = new Set<string>(preferredChineseFontFamilies);
function orderFonts(fonts: FontRecord[]) {
return [...fonts].sort((a, b) => {
return a.family.localeCompare(b.family, undefined, { sensitivity: "base" });
});
}
export const fontList = orderFonts([...standardFontList, ...webFontList]);
export const fontList = [...standardFontList, ...webFontList].sort((a, b) =>
a.family.localeCompare(b.family, undefined, { sensitivity: "base" }),
);
for (const font of fontList) {
fontMap.set(font.family, font);
@@ -127,10 +123,6 @@ export function getFont(family: string) {
return alias ? fontMap.get(alias) : undefined;
}
function getFontCategory(family: string): FontCategory | null {
return getFont(family)?.category ?? null;
}
export function getFontDisplayName(family: string) {
return fontDisplayNames[family] ?? family;
}
@@ -185,7 +177,7 @@ export function getPdfFallbackFontFamilies(
family: string,
options: { locale?: Locale; scripts?: Iterable<Script> } = {},
): string[] {
const category = getFontCategory(family);
const category = getFont(family)?.category ?? null;
const ordered: Script[] = [];
const localeScript = getLocaleScript(options.locale);