OTF font works fine with Prawn until you print
excid3 opened this issue · 2 comments
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.
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
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.
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'),
}