prawnpdf / prawn

Fast, Nimble PDF Writer for Ruby
https://prawnpdf.org
Other
4.68k stars 688 forks source link

Embedded TTF font will not open in Adobe Reader: "Cannot extract the embedded font" #1142

Closed jeffblake closed 4 years ago

jeffblake commented 4 years ago

Starting a new issue for visibility, but this 10 year old issue is also relevant: https://github.com/prawnpdf/prawn/issues/94

I'm using Open Sans from the google font website.

Attached sample PDF. It opens fine in Chrome, Mac Preview, but will not open in Adobe Acrobat (latest mac version)

When opening, the error is: "Cannot extract the embedded font '9ab1c0+OpenSans-Bold'. Some characters may not display or print correctly."

Relevant code from installing custom TTF font:

    font_families.update('Open Sans' => {
      normal: Rails.root.join('app', 'fonts', 'OpenSans-Regular.ttf').to_s,
      bold: Rails.root.join('app', 'fonts', 'OpenSans-Bold.ttf').to_s,
      italic: Rails.root.join('app', 'fonts', 'OpenSans-Italic.ttf').to_s,
      bold_italic: Rails.root.join('app', 'fonts', 'OpenSans-BoldItalic.ttf').to_s
    })
    font 'Open Sans', style: :normal

Honestly I would be fine using the default system font and not bothering with embedded TTF fonts, but then I lose portability and UTF-8 support. Any ideas?

Environment Ruby 2.6.5 Christy Sheppard (1).pdf

hquick81 commented 4 years ago

Same problem here, just appeared over night with no changes to our code

hquick81 commented 4 years ago

I seems to be related with the update of ttfunk. Rollback to ttfunk version 1.5.1 seems to be a workarround for now: https://github.com/prawnpdf/ttfunk/issues/72

excid3 commented 4 years ago

Just got notified by a user that the same thing is happening for our PDFs. Thanks for the tip about ttfunk @hjansen 👍

pointlessone commented 4 years ago

This issue should be fixed in TTFunk 1.6.2. Please upgrade and report any issues you have. Thank you for patience.

kevinchugh commented 3 years ago

This "cannot extract embedded font" issue is happening for me with ttfunk 1.7 was the fix reverted?