|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22613 imagettfbox() does not add the kerning distance to the running position
Submitted: 2003-03-09 05:54 UTC Modified: 2003-03-10 13:09 UTC
From: ljpersson at hotmail dot com Assigned:
Status: Closed Package: GD related
PHP Version: 4.3.0 OS: SuSE 8.0
Private report: No CVE-ID: None
 [2003-03-09 05:54 UTC] ljpersson at hotmail dot com
The calculation of TTF bounding box through ImageTTFBBox() is incorrect.

This shows up as the bounding box becomes a few pixels to wide when spaces or characters that extend below the baseline is used. If justa  few simple characters i.e. "abc" is used then it is corect but if you take the string (for example) " ab cgAj" then the bounding box is lightly to wide. All texts at zero angle.

I have made a simple example at

which clearly illustrates and describes the problem. 

In that thread there is also a suggestion for a fix (which I hadn't had time to verify myself). It seems that the kerning distance is not properly added to the running position.

Hence, the fix should be to in gdft.c replace 

pen.x += delta.x; 


pen.x += delta.x; 
penf.x += delta.x; 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-09 18:05 UTC]
As this is bug in GD itself, you should report it to 
the author of it too.

 [2003-03-10 13:09 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 08:01:29 2024 UTC