IssueRaiser

Requiring a variable font causes a type error

# Bug report When satori's .addFonts method is called, it calls opentype which (in a Next.js app) throws the following error ``` error - TypeError: Cannot read properties of undefined (reading '259') at parseFvarAxis (webpack-internal:///(middleware)/./node_modules/@shuding/opentype.js/dist/opentype.module.js:10290:22) at Object.parseFvarTable [as parse] (webpack-internal:///(middleware)/./node_modules/@shuding/opentype.js/dist/opentype.module.js:10326:13) at Object.parseBuffer [as parse] (webpack-internal:///(middleware)/./node_modules/@shuding/opentype.js/dist/opentype.module.js:11618:33) at vt.addFonts (webpack-internal:///(middleware)/./node_modules/satori/dist/esm/index.wasm.js:18:20138) at new vt (webpack-internal:///(middleware)/./node_modules/satori/dist/esm/index.wasm.js:18:19783) at mu (webpack-internal:///(middleware)/./node_modules/satori/dist/esm/index.wasm.js:18:49554) at Object.start (webpack-internal:///(middleware)/./node_modules/@vercel/og/dist/index.js:10:2973) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` ## Description / Observed Behavior Could not load a variable font ## Expected Behavior The font loads ## Reproduction ```ts const font = fetch( new URL( 'path/to/GeneralSans-Variable.ttf', import.meta.url, ), ).then(async res => res.arrayBuffer()); // Then load with: const options = { fonts: [ { name: "General Sans", data: await font, style: "normal", }, ], };

Posted by alii on Oct 11, 2022, 1:14 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

github (SaaS)

Requiring a variable font causes a type error

aliiOct 11, 2022, 1:14 AM

# Bug report When satori's .addFonts method is called, it calls opentype which (in a Next.js app) throws the following error ``` error - TypeError: Cannot read properties of undefined (reading '259') at parseFvarAxis (webpack-internal:///(middleware)/./node_modules/@shuding/opentype.js/dist/opentype.module.js:10290:22) at Object.parseFvarTable [as parse] (webpack-internal:///(middleware)/./node_modules/@shuding/opentype.js/dist/opentype.module.js:10326:13) at Object.parseBuffer [as parse] (webpack-internal:///(middleware)/./node_modules/@shuding/opentype.js/dist/opentype.module.js:11618:33) at vt.addFonts (webpack-internal:///(middleware)/./node_modules/satori/dist/esm/index.wasm.js:18:20138) at new vt (webpack-internal:///(middleware)/./node_modules/satori/dist/esm/index.wasm.js:18:19783) at mu (webpack-internal:///(middleware)/./node_modules/satori/dist/esm/index.wasm.js:18:49554) at Object.start (webpack-internal:///(middleware)/./node_modules/@vercel/og/dist/index.js:10:2973) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` ## Description / Observed Behavior Could not load a variable font ## Expected Behavior The font loads ## Reproduction ```ts const font = fetch( new URL( 'path/to/GeneralSans-Variable.ttf', import.meta.url, ), ).then(async res => res.arrayBuffer()); // Then load with: const options = { fonts: [ { name: "General Sans", data: await font, style: "normal", }, ], };

Comments (0)

No comments yet. Start the discussion.

Comment on this issue