fix: load fonts for exportToCanvas (#8298)

This commit is contained in:
Marcel Mraz 2024-07-30 17:23:35 +02:00 committed by GitHub
parent adcdbe2907
commit 5a0771ad9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 73 additions and 20 deletions

View file

@ -187,7 +187,13 @@ export const exportToCanvas = async (
canvas.height = height * appState.exportScale;
return { canvas, scale: appState.exportScale };
},
loadFonts: () => Promise<void> = async () => {
await Fonts.loadFontsForElements(elements);
},
) => {
// load font faces before continuing, by default leverages browsers' [FontFace API](https://developer.mozilla.org/en-US/docs/Web/API/FontFace)
await loadFonts();
const frameRendering = getFrameRenderingConfig(
exportingFrame ?? null,
appState.frameRendering ?? null,