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

OTF font works fine with Prawn until you print #98

Open
excid3 opened this issue Dec 16, 2022 · 2 comments
Open

OTF font works fine with Prawn until you print #98

excid3 opened this issue Dec 16, 2022 · 2 comments

Comments

@excid3
Copy link

excid3 commented Dec 16, 2022

I set up Prawn to use an OTF font (https://rsms.me/inter/download/) and everything renders fine in the browser.

However, when you go to print this on your printer, everything is garbled.
image

Using the TTF version of the font from Google Fonts, it prints just fine, so it appears to be a bug in OTF support.

cc @camertron

@camertron
Copy link
Member

Thanks for the bug report @excid3! Would it be possible for you to provide an example PDF that exhibits the problem? You should be able to attach it to this issue. If not then no worries, I can dig in without it.

@excid3
Copy link
Author

excid3 commented Dec 18, 2022

This example is from the Receipts gem.

If you clone the repo, there's a rake receipt task to generate a receipt PDF example. If you modify that to set the font to Inter .otf, that should reproduce it.

https://github.com/excid3/receipts/blob/master/Rakefile#L23

Should be able to paste this at the top of the rake task to set the font location:

Receipts.default_font = {
  bold: Rails.root.join('app/assets/fonts/Inter-Bold.otf'),
  normal: Rails.root.join('app/assets/fonts/Inter-Normal.otf'),
}

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

No branches or pull requests

2 participants