PIL cutting off letters

2007-06-15 Thread Matt Haggard
I'm using PIL (Python Imaging Library) to generate button images.
They consist of a left end image, a middle, repeating image and a
right side image anyway, that's not important

I'm using a TTF font for the text of the button (Verdana.TTF) and it
keeps cutting the bottom part of the the g's q's and y's off.

Here's the important parts of my code (options contains command-line
params):

im = Image.new("RGB",(1,1))
font = ImageFont.truetype(options.font,options.fontsize)
draw = ImageDraw.Draw(im)
textsize = draw.textsize(options.text, font=font)
im = im.resize( (totalwidth, maxheight) )
draw = ImageDraw.Draw(im)
thecolor = "rgb(0,0,0)"
x = (totalwidth - textsize[0]) / 2
y = (maxheight - textsize[1]) / 2 + options.offsetY
draw.text((x, y), options.text, font=font, fill=thecolor )
im.save(savefile, quality=100)

If I increase the font-size to larger than about 16, the tails
appear... any clue as to why this happens or what I can do to fix it?

-- 
http://mail.python.org/mailman/listinfo/python-list


unittest inconsistent

2010-01-06 Thread Matt Haggard
Can anyone tell me why this test fails?

http://pastebin.com/f20039b17

This is a minimal example of a much more complex thing I'm trying to
do.  I'm trying to hijack a function and inspect the args passed to it
by another function.

The reason the 'Tester' object has no attribute 'arg1' is because
"self" still refers to the object made for testA.
-- 
http://mail.python.org/mailman/listinfo/python-list