[Image-SIG] problem for drawing char J alone using font VeraIt.ttf

Alain Spineux aspineux at gmail.com
Sat Feb 17 02:48:22 CET 2007


When drawing character J alone using font VeraIt.ttf, only some pixels
are drawn on the left!

The problem looks to be in the font definition of char J.
The char is shifted a lot on the left !


Here is the sample.
You can try drawing '-J-' and 'J-'

from PIL import Image, ImageDraw, ImageFont, ImageTk
import PIL

border=50
c='J'
font=ImageFont.truetype('VeraIt.ttf', 36)
x, y=font.getsize(c)
print font.getsize(c), font.font.getsize(c)
img=Image.new('RGB', (border+x+border, border+y+border), (255, 255, 255))
draw=ImageDraw.Draw(img)
draw.rectangle((border, border, x+border-1, y+border-1),
outline=(0,0,0), fill=(255, 255, 255))
draw.text( (border, border), c, fill=(0, 0, 0), font=font)
del draw
img.show(command='gthumb')

Best regards.


--
Alain Spineux
aspineux gmail com
May the sources be with you


More information about the Image-SIG mailing list