(none) imager-devel
/ help / lists / applications / search /

Re: Bounding-Box: pos-width value incorrect

From: Tony Cook (
Date: Thu 24 Jul 2003 - 23:53:38 GMT

On Thu, Jul 24, 2003 at 05:09:02PM +0200, 10459@xyz.molar.is wrote:
> I'm using Imager for creating special charts in computational biology. For
> this purpose it's critical that I have maximum control over size and
> positioning of single characters. Thus, I tried to get the boundaries of the
> visible character, which is a lot smaller than the "sign" with all the
> surrounding white space, through the bounding_box method. Now, the problem
> is that I get a gap between the end of the visible character and the
> predicted end x + (bbox[2]-bbox[0]), but only with _some_ characters like
> 'G' or 'C', whereas 'X' or 'V' work perfectly. I add some sample code below.
> Some results I got can be seen under

You're running into a limitation in Imager's bounding_box() API.

$pos_width is the advamce width of the text provided, unless the last
character overflows it's cell, in which case that overflow is added on.

There currently isn't a way to access the offset of the right side of the
right-most glyph, though I can see a use for it.