#37730 [NEW]: ImageTTFText & ImageTTFBBox don't give accurate rectangle with angle

From: Date: Wed, 07 Jun 2006 15:28:14 +0000
Subject: #37730 [NEW]: ImageTTFText & ImageTTFBBox don't give accurate rectangle with angle
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-98142@lists.php.net to get a copy of this message
From: marc dot lazzaro at st dot com Operating system: Win XP PHP version: 5.1.4 PHP Bug Type: GD related Bug description: ImageTTFText & ImageTTFBBox don't give accurate rectangle with angle Description: ------------ Hello, ImageTTFText & ImageTTFBBox don't give accurate rectangle with angle other than 0. I work on a png image. Reproduce code: --------------- $xx = 30;$yy = 200;$tsize = 18;$tangle = 45; $p2 = ImageTTFText ($img, $tsize, $tangle, $xx, $yy, 'blue','C:/Windows/Fonts/arial.ttf',"MAgjpabiT01234567"); $p3 = @ImageTTFBBox($tsize, $tangle,'C:/Windows/Fonts/arial.ttf',"MAgjpabiT01234567"); for($i=0; $i < 4; ++$i) { $p3[$i*2] = round($p3[$i*2]+$xx+0.5); $p3[$i*2+1] = round($p3[$i*2+1]+$yy+0.5); } imageline($img,$p2[0],$p2[1],$p2[2],$p2[3],'red'); imageline($img,$p2[2],$p2[3],$p2[4],$p2[5],'red'); imageline($img,$p2[4],$p2[5],$p2[6],$p2[7],'red'); imageline($img,$p2[6],$p2[7],$p2[0],$p2[1],'red'); Expected result: ---------------- I would expext to draw a rectangle fitting exactly around the drawn text. This is true when angle is 0 but no more when rotating the text. Looks like the surrounding box shift on the left versus the text when angle increase. Actual result: -------------- I only have png image to show. If needed you can contact me by email. Thanks for all your efforts in developping PHP. -- Edit bug report at http://bugs.php.net/?id=37730&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37730&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37730&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37730&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37730&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37730&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37730&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37730&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37730&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37730&r=support Expected behavior: http://bugs.php.net/fix.php?id=37730&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37730&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37730&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37730&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37730&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37730&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37730&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37730&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37730&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37730&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37730&r=mysqlcfg

« previous php.bugs (#98142) next »