[Image-SIG] Strange Truetype ImageFont rendering behavior

Oliver Weichhold oliver at weichhold.com
Thu Mar 12 22:30:47 CET 2009


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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090312/a48ca156/attachment.htm>


More information about the Image-SIG mailing list