From: sks76543210 at gmail dot com
Operating system: CentOS 5
PHP version: 5.3SVN-2010-02-09 (snap)
PHP Bug Type: GD related
Bug description: imagettftext/imagettfbbox return wrong coordinates if angle != 0
Description:
------------
imagettftext() and imagettfbbox() both return wrong bounding box if the
angle is not set to 0. This sounds similar to a bug closed last year at
http://bugs.php.net/bug.php?id=43073
See http://www.yessum.org/gdbug2/ for font and samples.
This bug appears
to be in 5.1.6, and has since gotten worse in the latest svn.
Also, in 5.3.3-dev, the text doesn't seem to even be on the same baseline
on many of the angles.
Reproduce code:
---------------
<?php
$font = './cour.ttf'; // Courier New
$im = imagecreatetruecolor(600, 600);
imagefill($im, 0, 0, imagecolorallocate($im, 224, 224, 224));
$black = imagecolorallocate($im, 0, 0, 0);
$red = imagecolorallocate($im, 255, 0, 0);
$angle = 0;
do {
$bbox = imagettftext($im, 16, $angle, 299, 299, $black, $font,
'The quick brown fox');
imagepolygon($im, $bbox, 4, $red);
$angle += 45;
} while ($angle < 360);
header('content-type: image/png');
imagepng($im);
Expected result:
----------------
The bounding box should be a bounding box
Actual result:
--------------
The string is not contained in the bounding box.
--
Edit bug report at http://bugs.php.net/?id=50971&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50971&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50971&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50971&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50971&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50971&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50971&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50971&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50971&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50971&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50971&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50971&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50971&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50971&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50971&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50971&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50971&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50971&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50971&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50971&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50971&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50971&r=mysqlcfg