[Image-SIG] ImageFont getmask() bug?

Fredrik Lundh fredrik at pythonware.com
Wed May 17 16:18:35 CEST 2006

"michal bozon" wrote:

> following code, which uses PIL 1.1.5,
> generates a bitmap of text "of" rendered in Georgia font,
> but the result is strange, it seems like the rightmost
> pixel column is shifted to the left,
> it belongs to the "f" letter.
> import ImageFont
> fp = '/usr/share/fonts/corefonts/'
> font = ImageFont.truetype(fp+'georgia.ttf', 10)
> m = font.getmask('of', mode='1')
> m.save_ppm('of.ppm')
> The result PPM file and magnified PNG file should be attached.

the truetype renderer gets the "bearing" wrong for some characters in some 

this is being worked on for 1.1.6; for 1.1.5 and earlier, you can work 
around most
problems by adding a leading and trailing space (and adjusting the text 


More information about the Image-SIG mailing list