[reportlab-users] [PATCH] Add TTF Embedding Option

Robin Becker robin at reportlab.com
Fri Oct 17 05:09:08 EDT 2008

Andy Robinson wrote:

>> "Never Embed" list, if any non-CP1252 characters are used and for

>> certain CP1252 characters. The latter seems to kick in at the 181 range

>> but not for all 181 to 255 code points.


I'm guessing that one or other of the standard encodings is being used for the
first subset. It might be cp1252 or perhaps one of the other adobe standards eg

> Aha, that makes sense. I have no idea how many glyphs are supported

> in the fonts already in Adobe Reader, but if you step outside those,

> I guess it needs to embed any extra characters.


>> I am. The difference is still pretty large, though. Examples attached

>> [stripped]. Acrobat-Arial.pdf [43KB] and ReportLab-Arial.pdf [129KB] are

>> the "same" document using all four variants of Arial, embedded. I'm on

>> Acrobat 9 but had it generate a 1.3 PDF.

>> ReportLab-Arial-Small.pdf

>> [45KB] was with setting asciiReadable to 0; it's much smaller although

>> I'm not sure I understand all the implications.

asciiReadable just prepopulates the first subset with something which matches
the ordinary ascii values. That means when you look at the pdf code in an editor
many characters will be readable in the first subset.

If you turn off asciiReadable then the subsets work more naturally and you only
embed the glyphs which are used. For many applications that might be many fewer
than the initial pre-population that we assume to make ascii readable.

If a ttf font is on the never-embed list then presumably we can make the
assumption that there's some initial subset (which we need to firm up) and then
succeeding subsets are generated in the standard way. At object embedding time
we just don't bother with the first subset. That would make the splitString
mechanism work as before.

What happens when these files are delivered to a platform that doesn't have the
font? I notice that you appear to have attached some files to one of your
emails, but I didn't see them come through.
Robin Becker

More information about the reportlab-users mailing list