List Info

Thread: ImageFont getmask() bug?




ImageFont getmask() bug?
user name
2006-05-17 14:18:35
"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 
fonts.

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 
position
accordingly).

</F> 



_______________________________________________
Image-SIG maillist  -  Image-SIGpython.org
htt
p://mail.python.org/mailman/listinfo/image-sig
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )