ID: 50971
Updated by: pajoye@php.net
Reported By: sks76543210 at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: GD related
Operating System: CentOS 5
PHP Version: 5.3SVN-2010-02-09 (snap)
New Comment:
Which GD library do you use? Bundled?
Previous Comments:
------------------------------------------------------------------------
[2010-02-09 06:39:41] sks76543210 at gmail dot com
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 this bug report at http://bugs.php.net/?id=50971&edit=1