Pdfkit: Error: Variations require a font with the fvar, gvar, and glyf tables.

Created on 3 Apr 2017  路  1Comment  路  Source: foliojs/pdfkit

The error apppeared after I upgraded pdfkit from 0.7.2 to 0.8.0. Fontkit version: 1.5.4. (I'm not sure what version was there before the upgrade).

Error: Variations require a font with the fvar, gvar, and glyf tables.
at TTFFont.getVariation (/home/kola/server/node_modules/pdfkit/node_modules/fontkit/index.js:11966:13)
at TTFFont.getFont (/home/kola/server/node_modules/pdfkit/node_modules/fontkit/index.js:12000:17)
at Object.fontkit.create (/home/kola/server/node_modules/pdfkit/node_modules/fontkit/index.js:75:21)
at Object.fontkit.openSync (/home/kola/server/node_modules/pdfkit/node_modules/fontkit/index.js:43:18)
at Function.PDFFont.open (/home/kola/server/node_modules/pdfkit/js/font.js:14:24)
at PDFDocument.font (/home/kola/server/node_modules/pdfkit/js/mixins/fonts.js:39:28)

The error occurs when I use .registerFont and .font.

doc = new PDFDocument( size: 'letter', margin: 0 )
doc.registerFont('light', 'public/assets/font/OpenSans-Light.ttf', 'OpenSans-Light')
doc.font('light').fillColor('white').fontSize(18).text('Hello', 0, 8, align: 'center')

There is no error when I use the path to the font every time.

doc.font('public/assets/font/OpenSans-Light.ttf').fillColor('white').fontSize(18).text('Hello', 0, 8, align: 'center')

Most helpful comment

For TTF fonts, you don't need the postscript name (second argument), since there is only one font in the file. That argument is for TTC or DFont files which are font collections, with multiple fonts in one file.

>All comments

For TTF fonts, you don't need the postscript name (second argument), since there is only one font in the file. That argument is for TTC or DFont files which are font collections, with multiple fonts in one file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vovkvlad picture vovkvlad  路  5Comments

oknoorap picture oknoorap  路  4Comments

edmelly picture edmelly  路  5Comments

michapixel picture michapixel  路  4Comments

raesche picture raesche  路  4Comments