foliojs / pdfkit

A JavaScript PDF generation library for Node and the browser

Home Page:http://pdfkit.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error embedding font in PDF

kryops opened this issue · comments

Bug Report

Description of the problem

Hi there,

I have discovered an obscure issue when using a font generated with fonteditor-core in a PDF generated with PDFKit. I wasn't able to find out where the problem actually comes from, so I'm opening this issue in both repos 😅 => kekee000/fonteditor-core#58

When embedding the generated font into a PDF file, something seems to be off - most PDF viewers are fine, but Adobe Reader displays the following message:

image

I found out that kekee000/fonteditor-core@78a19e3 is the commit that causes the problem - I'm just not sure whether the generated font is somehow invalid, or PDFKit has a problem embedding the whitespace glyfs that were added in this commit.

Could you have a look into it? Thanks so much!

Code sample

I made a minimal reproduction in https://github.com/kryops/fonteditor-pdfkit-bug - in the dist folder there are the font files and PDFs generated with different versions of fonteditor-core.

Your environment

  • pdfkit version: 0.13.0
  • Node version: 20.5.1
  • Operating System: macOS

My problem was fixed in kekee000/fonteditor-core@9df6a9e. Maybe Adobe Reader and some other PDF tools just have problems with whitespaces in the Glyf data?