Skip to content

Commit 6467690

Browse files
committed
web: Fix TS issues for fontSources
1 parent 116186c commit 6467690

File tree

1 file changed

+13
-11
lines changed
  • web/packages/core/src/internal/player

1 file changed

+13
-11
lines changed

web/packages/core/src/internal/player/inner.tsx

+13-11
Original file line numberDiff line numberDiff line change
@@ -615,17 +615,19 @@ export class InnerPlayer {
615615
}
616616
} else if (typeof fontSource === "object") {
617617
// Handle new format (object with additional properties)
618-
try {
619-
const response = await fetch(key);
620-
builder.addFont(
621-
key,
622-
typeof fontSource['name'] === "string" ? fontSource['name'] : null,
623-
typeof fontSource['bold'] === "boolean" ? fontSource['bold'] : null,
624-
typeof fontSource['italics'] === "boolean" ? fontSource['italics'] : null,
625-
new Uint8Array(await response.arrayBuffer()),
626-
);
627-
} catch (error) {
628-
console.warn(`Couldn't download font source from ${key}`, error);
618+
for (const [url, fontInfo] of Object.entries(fontSource)) {
619+
try {
620+
const response = await fetch(url);
621+
builder.addFont(
622+
url,
623+
fontInfo?.['name'] || null,
624+
fontInfo?.['bold'] ?? null,
625+
fontInfo?.['italics'] ?? null,
626+
new Uint8Array(await response.arrayBuffer()),
627+
);
628+
} catch (error) {
629+
console.warn(`Couldn't download font source from ${key}`, error);
630+
}
629631
}
630632
}
631633
}

0 commit comments

Comments
 (0)