[Image-SIG] Strange Truetype ImageFont rendering behavior

Fredrik Lundh fredrik at pythonware.com
Fri Mar 13 12:08:10 CET 2009


Seems to work for me (see attachment).  However, I just realized that
I have a rather old version of Freetype on this machine (2.1.10).
What version are you using?

</F>

2009/3/12 Oliver Weichhold <oliver at weichhold.com>:
> The code snippet below produces the following two result images on my
> system:
> Arial:
> http://farm4.static.flickr.com/3658/3349324835_ecbb460afb_o.jpg
>
> TrajanPro-Bold:
> http://farm4.static.flickr.com/3439/3349324795_71b1c1fd48_o.jpg
>
> I am totally puzzled as to why the font size is kind of applied horizontally
> for Trajan Bold. I've produced the images on a freshly installed Windows XP
> 64 with Python 2.61 + PIL 1.1.6.
> Any suggestions what's going on here?
> <snip>
> from PIL import Image, ImageOps
> from PIL import ImageFont, ImageDraw
> arial = ImageFont.truetype("Arial.ttf", 24)
> trajan = ImageFont.truetype("TrajanPro-Bold.otf", 24)
> def render_msg(font, filename):
> im = Image.new("RGB", (200,50), "#ddd")
> draw = ImageDraw.Draw(im)
> draw.text((10,10), "Run awayyyy!", font=font, fill="red")
> im.save(filename)
> render_msg(arial, 'f1.jpg')
> render_msg(trajan, 'f2.jpg')
> </snip>
>
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.gif
Type: image/gif
Size: 2379 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090313/6705218e/attachment.gif>


More information about the Image-SIG mailing list