[reportlab-users] CPU Loop in graphics caused by uppercase font filename

Andy Robinson andy at reportlab.com
Wed Jan 10 12:33:11 EST 2007


Roger wrote:

> I an a relatively new user and have been using the Reportlab 2.0

> graphics package to produce vertical bar charts. Yesterday I tried to

> change the default font from Times-Roman to Helvetica by passing a

> fontName parameter (on Windows/XP):

> lab = Label(fontName='Helvetica')

>

> This caused a 100% CPU loop somewhere in the graphics package. By

> trying various fonts, I found that I could specify Times-Italic and

> Times-Bold without problem and the difference was that

> pdfbase/_fontdata.py (~line 52) specified lowercase font filenames

> (_a______) and my filenames for Helvetica were uppercase (_A______.PFB

> and _A______.PFM). Renaming the font files to use a lowercase "a"

> solved the CPU loop problem.


We'll fix this and let you know when it's done so you can pick up a new
copy from subversion or the daily builds. It certainly ought not to
loop like this.



> In addition to Helvetica, the case problem also exists for

> Helvetica-Bold, Helvetica-Italic, Symbol, and ZapDingBats. I can easily

> rename the files to fix the problem, the problem seems to be in finding

> the correct fonts to download. Although I couldn't find the reference

> this morning, I recall the docs pointed me to www.adobe.com as a source

> for downloading the PFB/PFM fonts to be copied to the Reportlab/fonts

> directory. I wasn't been able to find the fonts on the Adobe website

> and ended up copying the fonts from a Acrobat 5 installation on an older

> laptop. The newer versions of Acrobat do not seem to have the fonts.

>

> For the record, can someone point me to the documentation on how I

> should have acquired the correctly named fonts?


It's deliberately undocumented. Copying them from an earlier version of
Adobe Reader is what you are supposed to do. We don't want to be in the
position of officially and noisily redistributing Adobe's font files,
even if they were available in free software Adobe offered to millions
of users until recently, unless someone from officially says so.

I've sent you a link by private email to where you can find the files,
but I am pretty sure they are the same as your ones apart from the case
difference.

There are now open source alternatives, and we'll try to point people to
an alternative set of files they can install, and document this better
on the next release.

There used to be a pretty strong assumption in the postscript/PDF files
that the 'standard fonts' were always available. But I think that is
weakening nowadays. Some new PDF archive standards are calling for the
fonts always to be embedded. I'm beginning to think it would be better
for us to bundle some open source fonts, or even some which Microsoft
officially makes available for web developers, so that everything works
"out of the box" with renderPM.



Best Regards,

Andy Robinson


More information about the reportlab-users mailing list