List Info

Thread: problem for drawing char J alone using font VeraIt.ttf




problem for drawing char J alone using font VeraIt.ttf
user name
2007-02-16 19:48:22
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
_______________________________________________
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 )