php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39071 imagettftext cuts off first pixel
Submitted: 2006-10-06 21:43 UTC Modified: 2006-10-15 01:00 UTC
From: joel at seligstein dot com Assigned: pajoye (profile)
Status: No Feedback Package: GD related
PHP Version: 5.1.6 OS: Irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: joel at seligstein dot com
New email:
PHP Version: OS:

 

 [2006-10-06 21:43 UTC] joel at seligstein dot com
Description:
------------
Using text anywhere on an image using a local font (copy of Verdana.TTF), imagettffont cuts off the first pixel.  This is easily evident in the capital letter I.

gd_info():
array(12) {
  ["GD Version"]=>
  string(27) "bundled (2.0.28 compatible)"
  ["FreeType Support"]=>
  bool(true)
  ["FreeType Linkage"]=>
  string(13) "with freetype"
  ["T1Lib Support"]=>
  bool(false)
  ["GIF Read Support"]=>
  bool(true)
  ["GIF Create Support"]=>
  bool(true)
  ["JPG Support"]=>
  bool(true)
  ["PNG Support"]=>
  bool(true)
  ["WBMP Support"]=>
  bool(true)
  ["XPM Support"]=>
  bool(false)
  ["XBM Support"]=>
  bool(true)
  ["JIS-mapped Japanese Font Support"]=>
  bool(false)
}


Reproduce code:
---------------
header( "Content-type: image/png" );
$i = imagecreate(100,100);
$white = imagecolorallocate($i,255,255,255);
$black = imagecolorallocate($i,0,0,0);
imagefill( $i, 0,0,$white);
imagettftext( $i, 10, 0, 30, 30, $black, "/path/to/Verdana.TTF", "I am testing" );
imagepng($i);

And you will see the letter I has the first pixel cut off.



Expected result:
----------------
I'd expect full letters, not missing the first pixel.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-06 22:01 UTC] joel at seligstein dot com
After other tests, this appears just to be the capital I letter.
 [2006-10-06 22:05 UTC] joel at seligstein dot com
I'm going to keep changing my mind, here.  The J obviously is missing a pixel as well.  It appears some or all of the letters are mixing a pixel.
 [2006-10-07 06:13 UTC] pajoye@php.net
Please provide a link to the TTF file. Which freetype version do you use?
 [2006-10-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 06:01:32 2025 UTC