Merge branch 'fonts-preloading' into 'master'
Fonts preloading See merge request dungeonslayers/ds4!160
This commit is contained in:
commit
49cce13033
2 changed files with 13 additions and 3 deletions
|
@ -2,8 +2,18 @@
|
|||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
const fonts = ["Lora", "Wood Stamp"];
|
||||
const basicFonts = ["Wood Stamp"];
|
||||
const variantFonts = ["Lora"];
|
||||
|
||||
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)));
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
|
||||
export default function registerHandlebarsHelpers(): void {
|
||||
Object.entries(helpers).forEach(([key, helper]) => Handlebars.registerHelper(key, helper));
|
||||
Handlebars.registerHelper(helpers);
|
||||
}
|
||||
|
||||
const helpers = {
|
||||
|
|
Loading…
Reference in a new issue