ID: 50971 User updated by: sks76543210 at gmail dot com Reported By: sks76543210 at gmail dot com -Status: Feedback +Status: Open Bug Type: GD related Operating System: CentOS 5 PHP Version: 5.3SVN-2010-02-09 (snap) New Comment:
The bug occurs in the two PHP versions I have available to test on here. Perhaps I can try on a win32 box when I get to work. PHP 5.3.3-dev compiled from src ------------------------------- GD Version: bundled (2.0.34 compatible) Freetype Version: 2.2.1 ./configure --with-apxs2=/home/user/bin/httpd/bin/apxs --prefix=/home/user/bin/php --with-pdo-mysql --with-zlib --with-gd --with-gettext --with-freetype-dir --enable-gd-native-ttf PHP 5.1.6 from centos rpms -------------------------- GD Version: bundled (2.0.28 compatible) FreeType Version 2.2.1 Previous Comments: ------------------------------------------------------------------------ [2010-02-09 09:53:59] paj...@php.net Which GD library do you use? Bundled? ------------------------------------------------------------------------ [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