Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 11291
Status: resolved
Priority: 0/
Queue: Imager

People
Owner: TONYC [...] cpan.org
Requestors: bsb [...] sanger.ac.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.43
Fixed in: (no value)



Subject: Inconsistent bounding box information/letter sizing
As you can see in the attached image, I'm using Imager and Freetype to create some kind of diagram. The Letters in the Columns should fill the whole width of the column. Thus, I use the $bbox->total_width to get the width, find the difference between target width and effective visible width and rescale/adjust the letter. This normally works fine, but since I switched to the OO interface to bbox, I get these wrongly sized letters every now and then. Upgrading from 0.43 to 0.44 changed the position of the bug, i.e. other letters where affected. Changing the Image size changes which letters are affected. I use Perl 5.8.1 on a Mac, Imager 0.44, Freetype 2 v. 9.2.3 and the Arial TT font for the letters. Thanks for your help, Benjamin
Download logo.png
image/png 36.2k
logo.png
From: Tony Cook <tony [...] develop-help.com>
Date: Tue, 1 Feb 2005 00:59:56 +1100
To: Guest via RT <bug-Imager [...] rt.cpan.org>
Subject: Re: [cpan #11291] Inconsistent bounding box information/letter sizing
RT-Send-Cc:
On Mon, Jan 31, 2005 at 05:35:59AM -0500, Guest via RT wrote: Show quoted text
> As you can see in the attached image, I'm using Imager and Freetype to create some kind of diagram. The Letters in the Columns should fill the whole width of the column. Thus, I use the $bbox->total_width to get the width, find the difference between target width and effective visible width and rescale/adjust the letter. This normally works fine, but since I switched to the OO interface to bbox, I get these wrongly sized letters every now and then. Upgrading from 0.43 to 0.44 changed the position of the bug, i.e. other letters where affected. Changing the Image size changes which letters are affected.
Hi, I've looked at this problem. It seems to be a long standing issue with the calculation of the right side bearing for glyphs. - the calculated right-side bearing wasn't being scaled from FT2's fixed point convention to an integer This was not a problem with the OO interface to bbox. There's another problem which will stop glyphs with a non-zero right- side bearing from filling the width. Currently the width value returned by the bounding box functions will include the right-side bearing of the final glyph, this means that you will see space to the right of characters like "b" in the Arial font. This isn't quite so simple to fix, since it requires some change in common to all of the font drivers, but it is something I plan to change (compatibly) in 0.45. Included below is a patch to freetyp2.c that calculates the right- side bearing correctly. Tony Index: freetyp2.c =================================================================== RCS file: /cvsroot/Imager/freetyp2.c,v retrieving revision 1.20 diff -u -r1.20 freetyp2.c --- freetyp2.c 24 Jan 2005 13:18:48 -0000 1.20 +++ freetyp2.c 31 Jan 2005 13:59:07 -0000 @@ -388,7 +388,7 @@ /* last character handle the case where the right the of the character overlaps the right*/ - rightb = gm->horiAdvance - gm->horiBearingX - gm->width; + rightb = (gm->horiAdvance - gm->horiBearingX - gm->width)/64; if (rightb > 0) rightb = 0; }