-
Notifications
You must be signed in to change notification settings - Fork 236
Open
Description
I am currently trying to implement Iosevka as a custom Font in pdf-lib via fontkit using this code:
this.pdfDoc.registerFontkit(fontkit)
const custfontBytes = await fetch('/fonts/IosevkaFixed-Regular.ttf').then((res) => res.arrayBuffer());
const custfontBoldBytes = await fetch('/fonts/IosevkaFixed-Bold.ttf').then((res) => res.arrayBuffer());
this.custfont = await this.pdfDoc.embedFont(custfontBytes);
this.custfontBold = await `this.pdfDoc.embedFont(custfontBoldBytes);
Doing this results these 2 errors in the Browser console
Error generating registration form: Error: Not a fixed size
at exports.resolveLength (@pdf-lib_fontkit.js?v=661a131a:14518:15)
at ArrayT2.decode (@pdf-lib_fontkit.js?v=661a131a:14559:28)
at Struct3._parseFields (@pdf-lib_fontkit.js?v=661a131a:15044:24)
at VersionedStruct3.decode (@pdf-lib_fontkit.js?v=661a131a:15173:14)
at @pdf-lib_fontkit.js?v=661a131a:15330:32
at Pointer3.decode (@pdf-lib_fontkit.js?v=661a131a:15340:18)
at ArrayT2.decode (@pdf-lib_fontkit.js?v=661a131a:14586:32)
at Struct3._parseFields (@pdf-lib_fontkit.js?v=661a131a:15044:24)
at Struct3.decode (@pdf-lib_fontkit.js?v=661a131a:15011:14)
at @pdf-lib_fontkit.js?v=661a131a:15330:32
Error generating PDF: Error: Not a fixed size
at exports.resolveLength (@pdf-lib_fontkit.js?v=661a131a:14518:15)
at ArrayT2.decode (@pdf-lib_fontkit.js?v=661a131a:14559:28)
at Struct3._parseFields (@pdf-lib_fontkit.js?v=661a131a:15044:24)
at VersionedStruct3.decode (@pdf-lib_fontkit.js?v=661a131a:15173:14)
at @pdf-lib_fontkit.js?v=661a131a:15330:32
at Pointer3.decode (@pdf-lib_fontkit.js?v=661a131a:15340:18)
at ArrayT2.decode (@pdf-lib_fontkit.js?v=661a131a:14586:32)
at Struct3._parseFields (@pdf-lib_fontkit.js?v=661a131a:15044:24)
at Struct3.decode (@pdf-lib_fontkit.js?v=661a131a:15011:14)
at @pdf-lib_fontkit.js?v=661a131a:15330:32
I am already using the fixed version of this font therefore this seems like a bug. If I replace Iosevka with SpaceMono, the PDF is generated correctly.
I have opened an issue with Iosevka here: be5invis/Iosevka#3009. They identified the problem being that Fontkit is not correctly supporting reverse chained contexts single substitution. See also the resolution comment in the ticket.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels