Skip to content

Error when trying to embed woff2 font #544

Description

@codeandcats

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions