universal unicode font for reportlab

Tim Roberts timr at probo.com
Fri Sep 12 23:33:20 EDT 2008


Duncan Booth <duncan.booth at invalid.invalid> wrote:
>
>The not too scientific test I did was to copy the font embedding example 
>from the Reportlab documentation, modify it enough to make it actually 
>run, and then change the output to have only one glyph. The resulting 
>PDF is virtually identical. I'm not a reportlab expert though so I may 
>have made some blindingly obvious beginners mistake (or maybe it only 
>subsets fonts over a certain size or glyphs outside the ascii range?).
>
>---------- rlab.py ------------
>import os, sys
>import reportlab
>folder = os.path.dirname(reportlab.__file__) + os.sep + 'fonts'
>afmFile = os.path.join(folder, 'LeERC___.AFM')
>pfbFile = os.path.join(folder, 'LeERC___.PFB')
>from reportlab.pdfbase import pdfmetrics
>justFace = pdfmetrics.EmbeddedType1Face(afmFile, pfbFile)
>faceName = 'LettErrorRobot-Chrome' # pulled from AFM file
>pdfmetrics.registerTypeFace(justFace)
>justFont = pdfmetrics.Font('LettErrorRobot-Chrome',faceName,'WinAnsiEncoding')

OK, look the other way while I backpedal furiously.  The conversation on
the mailing last year was focused on TrueType fonts.  Those are subsetted.

EmbeddedType1Face, used for Type 1 fonts, does appear to embed the entire
font.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list