fix: properly preload bold and italic font variants
This commit is contained in:
parent
43385299c4
commit
0bbfdaf381
1 changed files with 12 additions and 2 deletions
|
@ -2,8 +2,18 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
const fonts = ["Lora", "Wood Stamp"];
|
const basicFonts = ["Wood Stamp"];
|
||||||
|
const variantFonts = ["Lora"];
|
||||||
|
|
||||||
export async function preloadFonts(): Promise<FontFace[][]> {
|
export async function preloadFonts(): Promise<FontFace[][]> {
|
||||||
return Promise.all(fonts.map((font) => document.fonts.load(`1rem ${font}`)));
|
const fonts = [
|
||||||
|
...basicFonts.map((font) => `1rem ${font}`),
|
||||||
|
...variantFonts.flatMap((font) => [
|
||||||
|
`1rem ${font}`,
|
||||||
|
`bold 1rem ${font}`,
|
||||||
|
`italic 1rem ${font}`,
|
||||||
|
`bold italic 1rem ${font}`,
|
||||||
|
]),
|
||||||
|
];
|
||||||
|
return Promise.all(fonts.map((font) => document.fonts.load(font)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue