TTF text bounding box problem (imagettftext)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Using PHP-4.3.11 with GD extension, bundled GD library, and freetype-2.1.9
(with 6.8.1). I can't get the TrueType Font (TTF) bounding box to
come out right. Whether using imagettftext() or imagettfbbox(), for some
angles of text (like 45 degrees), the box comes back in the wrong place.
Sample code below; just change the $font assignment to point to a TTF font
file. You should see a text string with a box around it, but my box isn't
always around the text, depending on the $angle.

Could someone please sanity check this before I open a bug report?

# PHP GD TTF Bounding Box Test
# Change this to the full path of a TrueType font you have:
$font = '/usr/local/lib/fonts/truetype/arial.ttf';
$size = 36.0;
$angle = 135.0;  # Try 45, 135, 260 degrees for example

$g = imagecreate(800, 600);
$white = imagecolorallocate($g, 255, 255, 255);
$black = imagecolorallocate($g, 0, 0, 0);
# Draw the text string:
$bbox = imagettftext($g, $size, $angle, 400, 300, $black, $font, 'ABCDEF');
# Draw the bounding box:
imagepolygon($g, $bbox, 4, $black);

header("Content-type: image/png");

Site Timeline