|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ljpersson at hotmail dot com
New email:
PHP Version: OS:


 [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-2020 The PHP Group
All rights reserved.
Last updated: Thu Feb 27 06:01:26 2020 UTC