From: joel at seligstein dot com
Operating system: Irrelevant
PHP version: 5.1.6
PHP Bug Type: GD related
Bug description: imagettftext cuts off first pixel
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.
--
Edit bug report at http://bugs.php.net/?id=39071&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39071&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39071&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39071&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39071&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39071&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39071&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39071&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39071&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39071&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39071&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39071&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39071&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39071&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39071&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39071&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39071&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39071&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39071&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39071&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39071&r=mysqlcfg