ds4/src/fonts.ts

20 lines
558 B
TypeScript
Raw Normal View History

2021-07-08 23:32:22 +02:00
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
const basicFonts = ["Wood Stamp"];
const variantFonts = ["Lora"];
export async function preloadFonts(): Promise<FontFace[][]> {
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)));
}