#37730 [Opn->Fbk]: ImageTTFText & ImageTTFBBox don't give accurate rectangle with angle

From: Date: Wed, 07 Jun 2006 16:44:58 +0000
Subject: #37730 [Opn->Fbk]: ImageTTFText & ImageTTFBBox don't give accurate rectangle with angle
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-98146@lists.php.net to get a copy of this message
ID: 37730 Updated by: pajoye@php.net Reported By: marc dot lazzaro at st dot com -Status: Open +Status: Feedback Bug Type: GD related Operating System: Win XP PHP Version: 5.1.4 -Assigned To: +Assigned To: pajoye New Comment: Please provide a link to the font you use. Don't use '@' to hide possible errors or notices. Previous Comments: ------------------------------------------------------------------------ [2006-06-07 15:28:14] marc dot lazzaro at st dot com 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 this bug report at http://bugs.php.net/?id=37730&edit=1

« previous php.bugs (#98146) next »