web: Iterate defaultFonts instead of copying things manually; fixes missing japanese entries

This commit is contained in:
Nathan Adams 2024-06-06 23:40:35 +02:00
parent 17d9d01d6b
commit 49ca3b2ce1
1 changed files with 9 additions and 17 deletions

View File

@ -734,23 +734,15 @@ export class RufflePlayer extends HTMLElement {
}
}
if (this.loadedConfig?.defaultFonts?.sans) {
builder.setDefaultFont(
"sans",
this.loadedConfig?.defaultFonts.sans,
);
}
if (this.loadedConfig?.defaultFonts?.serif) {
builder!.setDefaultFont(
"serif",
this.loadedConfig?.defaultFonts.serif,
);
}
if (this.loadedConfig?.defaultFonts?.typewriter) {
builder!.setDefaultFont(
"typewriter",
this.loadedConfig?.defaultFonts.typewriter,
);
for (const key in this.loadedConfig?.defaultFonts) {
const names = (
this.loadedConfig.defaultFonts as {
[key: string]: Array<string>;
}
)[key];
if (names) {
builder.setDefaultFont(key, names);
}
}
this.instance = await builder.build(this.container, this).catch((e) => {