ID: 48732
Updated by: pajoye@php.net
Reported By: sta at netimage dot dk
-Status: Open
+Status: Assigned
Bug Type: GD related
Operating System: FreeBSD 7.1
PHP Version: 5.2.10
-Assigned To:
+Assigned To: tabe
New Comment:
Tabe, do you have the time to look at it please?
Previous Comments:
------------------------------------------------------------------------
[2009-07-03 22:42:13] lbayuk at pobox dot com
Duplicated in PHP-5.2.10 and also PHP-5.3.0. The descenders are being
excluded from the bounding box, at all angles. (Sigh. I was the one who
opened bug #43073 for rotated bounding boxes. My mistake for not
including characters with descenders in the original reproduce code.)
------------------------------------------------------------------------
[2009-07-03 11:02:32] sta at netimage dot dk
The fix for bug #48555 did not solve this problem - bug still open.
The test string should probably be changed to
"line1\nQÅDFqypådg!()/\%▓" so the new line problem from #48555 is
checked too.
------------------------------------------------------------------------
[2009-06-30 07:42:54] sta at netimage dot dk
To images, one rendered with PHP 5.2.9, the other with 5.2.10.
http://php.thing.dev.netimage.dk/48732_5_2_9.png
http://php.thing.dev.netimage.dk/48732_5_2_10.png
Both rendered on FreeBSD with freetype2-2.3.9_1 from ports.
------------------------------------------------------------------------
[2009-06-30 07:31:48] sta at netimage dot dk
Description:
------------
Bug #43073 fixed the bounding box for rotated texts.
Unfortunately the test case only used upper case ABCDEF for the test,
an not any letters that protrude below the text baseline.
Hence the returned bounding box is now wrong for text like ABCQÅqyp.
The code below is directly from bug #43073, only the font, demo-text
and font size has been changed.
Reproduce code:
---------------
<?php
$font = '/dana/data/ni_lib/ni_shop/fonts/CONGSEB.TTF'; # Full path to
any TTF Font
$delta_t = 360.0 / 16; # Make 16 steps around
$g = imagecreate(800, 800);
$bgnd = imagecolorallocate($g, 255, 255, 255);
$black = imagecolorallocate($g, 0, 0, 0);
$x = 100;
$y = 0;
$cos_t = cos(deg2rad($delta_t));
$sin_t = sin(deg2rad($delta_t));
for($angle = 0.0; $angle < 360.0; $angle += $delta_t) {
$bbox = imagettftext($g, 20, $angle, 400 + $x, 400 + $y, $black,
$font, 'QÅDFqypådg!()/\%▓');
imagepolygon($g, $bbox, 4, $black);
imagefilledellipse($g, $bbox [0], $bbox [1], 8, 8, $black);
$temp = $cos_t * $x + $sin_t * $y;
$y = $cos_t * $y - $sin_t * $x;
$x = $temp;
}
header( "Content-type: image/png");
imagepng($g);
Expected result:
----------------
That the rectangles contain the entire text, including the parts that
protrude below the text baseline.
Actual result:
--------------
Lower part of eg "q" are outside the box.
Images will be attached in a second.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48732&edit=1