[Image-SIG] Bug in BdfFontFile.py.

grahamd@dscpl.com.au grahamd@dscpl.com.au
Mon, 21 Apr 2003 22:22:45 -0600 (MDT)

Whoops, sorry for the last message being empty. :-)

Towards the end of the BdfFontFile.py file, the code should read:

            if ch >= 0 and ch <= 255:
                self.glyph[ch] = xy, dst, src, im

Currently the code doesn't check for an upper bound of "255" for "ch". This means that
if the BDF file throws up a larger value, Python raises an exception because the FontFile
base class only creates the "glyph" array with 256 entries.

This problem can occur when you take an MS arial ttf file, send it through the "ttf2bdf"
command from "freetype-1" contrib directory and then run the "pilfont.py" script on the
BDF files to generate PIL fonts.

I thought I had tried to report this some time back, but it seems the problem still exists
in 1.1.4a2 available from unstable branch of fink for the Mac, so maybe I didn't get around
to reporting it after all.