[Image-SIG] textsize Inconsistency between windows and linux

Norbert Cauderan norbidur at gmail.com
Fri Oct 15 09:53:34 CEST 2010


textsize for the same font and text gives different results on windows and
linux with PIL 1.1.6

from PIL import Image,ImageDraw, ImageFont
font = ImageFont.truetype("KOMTXT__.ttf", 18,encoding="unic")
im = Image.new("1", (1,1))
draw = ImageDraw.Draw(im)
draw.setfont(font)
textsize = draw.textsize(u'test me !',font=font)
print textsize[0]

on windows I have : 68
on linux (ubuntu 10.04) : 69

(the komika font can be get at
http://www.fonts4free.net/komika-text-font.html, same result can be achieved
with stock windows arial font)

Is there a way to be sure to have the same result on both platforms ? I
guess this has something to do with freetype and I could recompile linux
version with the exact same version used for the windows build, but how
could I know this version ?

Thank you for your help !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20101015/8112b3c8/attachment.html>


More information about the Image-SIG mailing list