ID:               21560
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ljpersson at hotmail dot com
-Status:           Verified
+Status:           Assigned
 Bug Type:         GD related
 Operating System: SusE 8.0
 PHP Version:      4.3.1-dev
 Assigned To:      pajoye
 New Comment:

don't forget.. :)



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

[2003-02-26 19:55:33] [EMAIL PROTECTED]

I confirm it too. I found where is the problem. I will try to fix it
before the next release.



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

[2003-02-13 12:19:10] [EMAIL PROTECTED]

Verified with latest CVS, this however appears to be an issue with the
GD library itself since the problem is not particular to the bundled
GD.

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

[2003-02-13 11:45:01] [EMAIL PROTECTED]

Please use the 'Edit submission' link when you reply to 
your _own_ report, otherwise the status remains at 'feedback'..and
eventually gets automatically suspended.


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

[2003-02-13 05:26:09] ljpersson at hotmail dot com

Below is a simple test script that illustates the problem. You might
need to change the path for the fonts to suit your setup.

The script strokes a text and then draws the bounding box around the
text. For angle = 0 the bounding box is correct but for any other angle
it is off proportional to the angle. 

(With GD 2.01 this is correct but for higher versions the problem
exists)

/Johan

<?php
DEFINE('TTF_DIR','/usr/X11R6/lib/X11/fonts/truetype/');

$w=400; $h=300;
$img = @imagecreatetruecolor($w,$h);
$black = imagecolorallocate ($img, 0, 0, 0);
$white = imagecolorallocate ($img, 255, 255, 255);
$red = imagecolorallocate ($img, 255, 0, 0);
imagefilledrectangle($img,0,0,$w,$h,$white);

$font = TTF_DIR.'arial.ttf';
$font_size = 14;
$txt = 'Some dummy text';
$x = 75; $y=250; 

// For angle == 0 the TTF box is correct 
$angle = 90;

imagettftext($img,$font_size,$angle,$x,$y,$black,$font,$txt);
$bbox = imagettfbbox(14,$angle,$font,$txt);

// Drwa the bounding box
imageline($img,$x+$bbox[0],$y+$bbox[1],$x+$bbox[2],$y+$bbox[3],$red);
imageline($img,$x+$bbox[0],$y+$bbox[1],$x+$bbox[6],$y+$bbox[7],$red);
imageline($img,$x+$bbox[6],$y+$bbox[7],$x+$bbox[4],$y+$bbox[5],$red);
imageline($img,$x+$bbox[4],$y+$bbox[5],$x+$bbox[2],$y+$bbox[3],$red);

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

/* 

print_r($bbox);

On SuSE 8.0 this gives (for angle=90):

PHP 4.2.3 With GD 2.01 gives [CORRECT]:  
Array ( [0] => 3 [1] => -1 [2] => 3 [3] => -154 
        [4] => -16 [5] => -154 [6] => -16 [7] => -2 ) 

PHP 4.2.3 With GD 2.08 gives [WRONG]:
Array ( [0] => -1 [1] => 13 [2] => -1 [3] => -153 
        [4] => -17 [5] => -153 [6] => -17 [7] => 13 ) 

PHP 4.3.0 With built-in GD gives [WRONG]:
Array ( [0] => -1 [1] => 13 [2] => -1 [3] => -153 
        [4] => -17 [5] => -153 [6] => -17 [7] => 13 ) 

PHP 4.3.1-dev (2002-02-07) [WRONG]
Array ( [0] => -1 [1] => 13 [2] => -1 [3] => -153 
        [4] => -17 [5] => -153 [6] => -17 [7] => 13 ) 
*/

?>

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

[2003-02-09 02:41:22] [EMAIL PROTECTED]

Hi,

Can you provide a link with the test script and the font used ?

thank's

pierre

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

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/21560

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

Reply via email to