Disabling font subsetting so that the full font gets embedded

86 views
Skip to first unread message

Radan Skorić

unread,
Jun 12, 2020, 5:08:22 AM6/12/20
to Prawn
Hi, I am trying to figure out if I can somehow force Prawn to forgo font subsetting and instead embed the full font. 

The motivation is that our users generate multiple pdfs from our system and sometimes later combine them. Combining pdfs with different subsets of the same font on the same page can lead to some characters not rendering in some pdf readers because the reader doesn't know that it should combine the two subsets and ends up using the wrong subset on part of the combined pdf. It can be fixed but it requires some pretty advanced usage of Acrobat full product. If they don't have the licence it's possible they even can't fix it. If we would generate the pdf with the full font the problem would be gone.

I went over the docs and read parts of the prawn and ttfunk code and I can't find a way to do that. I also found this 7 year old thread where Gregory Brown says that it is not supported but also says that he doesn't see why it wouldn't be supported: https://groups.google.com/forum/#!searchin/prawn-ruby/full$20font|sort:date/prawn-ruby/MsOrVAMt9mQ/3sUuTCIaDtkJ

Can someone help me understand if this is maybe possible now?

Going over the code of prawn it seems subsetting is quite ingrained in the code base. If I wanted to contribute this functionality, would someone be able to give me pointers on whether it's a feasible change and how one might go about adding this option?

Thank you,
Radan

Alexander Mankuta

unread,
Jun 12, 2020, 5:17:22 AM6/12/20
to Prawn
Hi,

As of right now there's no option to disable subsetting.

I don't recall from the top of my head but I believe subset fonts should have unique names in the resulting PDF so there should not be font name collisions. It feels like a bug.

I'd be happy to accept a PR for the option to disable font subsetting. You'd need to a document constructor option for this. Then you probably want to take a look at lib/prawn/font.rb and lib/prawn/font/* files for the subsetting itself. There probably no need to make any chages to TTFunk. Feel free to open a WIP PR for early comments.

--
Regards,
Alex

Radan Skorić

unread,
Jun 12, 2020, 9:27:43 AM6/12/20
to Prawn
Ok, thanks, I'll have a look. :)
Reply all
Reply to author
Forward
0 new messages