ID:               37730
 Comment by:       hopka at hopka dot net
 Reported By:      marc dot lazzaro at st dot com
 Status:           No Feedback
 Bug Type:         GD related
 Operating System: Win XP
 PHP Version:      5.1.4
 Assigned To:      pajoye
 New Comment:

I have the same problem with PHP 5.1.2 on Linux and 5.2.0 on Windows
XP. I use imagepolygon to render the bounding box and with a rotation
of 0 degrees (or 360, 720, etc) it fits around the text perfectly. As
soon as I set a different angle, the bounding box is too large and at
the wrong position.

I made a little demonstration script (includes source + phpinfo):
http://hopka.net/imagettfbbox.php5


Previous Comments:
------------------------------------------------------------------------

[2007-01-23 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2007-01-15 12:45:28] [EMAIL PROTECTED]

mail to pierre[at]libgd.org.

------------------------------------------------------------------------

[2006-06-08 06:57:29] marc dot lazzaro at st dot com

My company policy forbides external access. If you could provide an
email address I will send you the font file. But I have to say that the
behavior remains the same whatever the font is.
Also pls note that I got no errors when the @ is removed.

------------------------------------------------------------------------

[2006-06-07 16:44:58] [EMAIL PROTECTED]

Please provide a link to the font you use. Don't use '@' to hide
possible errors or notices.

------------------------------------------------------------------------

[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

Reply via email to