ID:               37730
 Comment by:       lbayuk at pobox dot com
 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 am also finding that the TrueType font bounding box from ImageTTFBBox
and ImageTTFText seems to be wrong for text at angles other than 0
degrees.  Using PHP-5.2.4 on Linux.  My test script just draws the
returned bounding box for text and angles from 0 to 360. It shows that
for text at 0 degrees, the box encloses the text, but for all other
angles the box is off by different amounts. The worst case is for text
between 180 and 270 degrees, where the text is completely outside the
bounding box.

My test script is about 50 lines long, and I would be happy to post or
mail it but I'm not sure what is correct. Let's not abandon this bug
report until we figure out whether PHP is at fault or we are using it
wrong.


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

[2007-03-09 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-03-01 12:00:29] hopka at hopka dot net

The font is standard Arial, the ttf i use is here:
http://hopka.net/Arial.ttf
However, i did try other fonts and i could not find any font that
produced different results.

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

[2007-03-01 11:45:44] [EMAIL PROTECTED]

"so i don't see how i should rotate the offset to get the correct
bounding box."

Your script is wrong, you add 100 to each vertex, no matter where they
are. The result rectangle is then drawn at the wrong place.

About the offset pixel, what I asked here remains. Please provide the
font as well.

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

[2007-03-01 11:40:15] hopka at hopka dot net

If i draw the box that imagettftext (sorry, did not try that before)
returns without modifying the coordinates, it is almost (1 pixel off)
the same as the box i get after adding 100 to each coordinate of
imagettfbbox' return value. That would mean that either imagettftext is
also wrong (because it produces the same results as my script) or that
one would also have to modify the coordinates returned by imagettftext.
Also, the rectangles returned by both functions are already rotated, so
i don't see how i should rotate the offset to get the correct bounding
box.

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

[2007-03-01 00:14:13] [EMAIL PROTECTED]

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

Your script is wrong, you forgot that each position is relative to the
origin of the text. Adding 100 to each of them is not correct. You have
to rotate the offset.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/37730

-- 
Edit this bug report at http://bugs.php.net/?id=37730&edit=1

Reply via email to