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