diff --git a/src/core/blitzkrieg/jsxToSvg/index.ts b/src/core/blitzkrieg/jsxToSvg/index.ts index 3dd896574..52f1b9f79 100644 --- a/src/core/blitzkrieg/jsxToSvg/index.ts +++ b/src/core/blitzkrieg/jsxToSvg/index.ts @@ -3,17 +3,17 @@ import satori from 'satori'; const fonts = [ { - data: readFileSync(require('./Roboto.ttf')), + file: require('./Roboto.ttf') as string, weight: 400 as const, name: 'Roboto', }, { - data: readFileSync(require('./Roboto-Bold.ttf')), + file: require('./Roboto-Bold.ttf') as string, weight: 700 as const, name: 'Roboto-Bold', }, { - data: readFileSync(require('./Roboto-Black.ttf')), + file: require('./Roboto-Black.ttf') as string, weight: 900 as const, name: 'Roboto-Black', }, @@ -22,6 +22,9 @@ const fonts = [ export default async function jsxToSvg(jsx: JSX.Element) { return await satori(jsx, { width: 480, - fonts, + fonts: fonts.map(({ file, ...font }) => ({ + data: readFileSync(`${__dirname}/${file}`), + ...font, + })), }); }