Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to embed woff2 font #544

Open
codeandcats opened this issue Sep 11, 2016 · 2 comments
Open

Error when trying to embed woff2 font #544

codeandcats opened this issue Sep 11, 2016 · 2 comments

Comments

@codeandcats
Copy link

In node, I've tried embedding a number of .woff2 fonts from Google Fonts but they all error with:

TypeError: Cannot read property 'length' of undefined                                                                                                                     
    at WOFF2Glyph._getContours (/node_modules/pdfkit/node_modules/fontkit/index.js:9464:33)                  
    at WOFF2Glyph._getPath (/node_modules/pdfkit/node_modules/fontkit/index.js:9499:27)                      
    at WOFF2Glyph.get (/node_modules/pdfkit/node_modules/fontkit/index.js:9067:19)                           
    at WOFF2Glyph.descriptor.get (/node_modules/pdfkit/node_modules/fontkit/index.js:92:21)                  
    at WOFF2Glyph._getCBox (/node_modules/pdfkit/node_modules/fontkit/index.js:11955:18)                     
    at WOFF2Glyph._getMetrics (/node_modules/pdfkit/node_modules/fontkit/index.js:9482:23)                   
    at WOFF2Glyph.get (/node_modules/pdfkit/node_modules/fontkit/index.js:9078:19)                           
    at WOFF2Glyph.descriptor.get (/node_modules/pdfkit/node_modules/fontkit/index.js:92:21)                  
    at new EmbeddedFont (/node_modules/pdfkit/js/font/embedded.js:23:43)                                     
    at Function.PDFFont.open (/node_modules/pdfkit/js/font.js:25:14) 

This simple project demonstrates the error.

Am I doing something wrong? All the .ttf files I've tried from Google Fonts appear to work fine.

@laurence-myers
Copy link

This also occurs in the browser.

The WOFF 1 files I've tried also have another, different error. "Unknown op: 0". It seems to be in the "_getPath" function.

@rsshilli
Copy link

rsshilli commented Oct 3, 2017

I had some luck in NodeJS by converting my TTF fonts to base64. More here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants