[Image-SIG] more on ImageFont.
Anthony Baxter
arb@connect.com.au
Sat, 11 Jul 1998 14:07:26 +1000
Ok, as of 0.3b1, I canna get ImageFont to do anything but error. I've tried
regenerating the .pil font files, and I've even dug into the C source code
(horrors).
File "test", line 10, in text
m=self.font.getmask(text)
File "/opt/python/lib/python1.5.1/site/ImageFont.py", line 87, in getmask
im.im.paste(self.image.im.crop(tuple(m[6:10])),
SystemError: NULL result without error in call_object
Breaking this down into
tmp2 = tuple(m[6:10]) # tmp2 = (55, 0, 59, 7)
tmp = self.image.im.crop(tmp2)
im.im.paste(tmp, (x0+x, y0, x1+x, y1))
shows the error occurs on the "crop()" line.
The problem appears to be in libImaging/Crop.c, in the ImagingCrop function.
This section of code was added between 0.2b3 and 0.3something. I'm stuffed
if I can figure out what it's meant to do, or how it's meant to work properly.
ifdef'ing this section out at least makes the getmask() calls seem to work.
Anyone know what it's meant to do?
/* Determine which region to copy */
xoff = yoff = 0;
if (x0 < 0)
xsize += x0, xoff = -x0, x0 = 0;
if (x0 + xsize > imOut->xsize)
xsize = imOut->xsize - x0;
if (y0 < 0)
ysize += y0, yoff = -y0, y0 = 0;
if (y0 + ysize > imOut->ysize)
ysize = imOut->ysize - y0;
if (xsize <= 0 || ysize <= 0)
return 0;
Anthony