Shorten the fontFile lookup a tiny bit

Rather than effectively duplicating code, we can use a loop instead.
This commit is contained in:
Jonas Jenwald 2026-05-24 10:19:34 +02:00
parent ea18e73de2
commit 31c6561b91
2 changed files with 5 additions and 12 deletions

View File

@ -4666,18 +4666,11 @@ class PartialEvaluator {
let fontFile, fontFileN, subtype, length1, length2, length3;
try {
fontFile = descriptor.get("FontFile");
if (fontFile) {
fontFileN = 1;
} else {
fontFile = descriptor.get("FontFile2");
for (const n of ["FontFile", "FontFile2", "FontFile3"]) {
fontFile = descriptor.get(n);
if (fontFile) {
fontFileN = 2;
} else {
fontFile = descriptor.get("FontFile3");
if (fontFile) {
fontFileN = 3;
}
fontFileN = n;
break;
}
}

View File

@ -2698,7 +2698,7 @@ class Font {
if (
(header.version === "OTTO" &&
(!properties.composite ||
(properties.fontFileN === 3 && parsedCff?.isCIDFont))) ||
(properties.fontFileN === "FontFile3" && parsedCff?.isCIDFont))) ||
!tables.head ||
!tables.hhea ||
!tables.maxp ||