ID: 21560 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Verified Bug Type: GD related Operating System: SusE 8.0 -PHP Version: 4.3.0 +PHP Version: 4.3.1-dev New Comment:
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. Previous Comments: ------------------------------------------------------------------------ [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] [EMAIL PROTECTED] 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 ------------------------------------------------------------------------ [2003-02-07 10:03:02] [EMAIL PROTECTED] The problem still exists in snapshot 200302071430 for the _exact_ same text string imagettfbbox() (and the _exact_ same test script) returns the following (different) values depending on version of PHP and GD Snapshot 200302071430 Array ( [0] => -1 [1] => 14 [2] => -1 [3] => -226 [4] => -16 [5] => -226 [6] => -16 [7] => 14 ) PHP 4.3 (official release) Array ( [0] => -1 [1] => 13 [2] => -1 [3] => -226 [4] => -16 [5] => -226 [6] => -16 [7] => 13 ) PHP 4.2.3 (with GD 2.01) Array ( [0] => 3 [1] => -1 [2] => 3 [3] => -234 [4] => -16 [5] => -234 [6] => -16 [7] => -2 ) The only correct values are with GD 2.01 for both PHP 4.3 and snapshot the bounding box is incorrect since it starts 14 (in snapshot) or 13 (in 4.3) pixels in into the text. ------------------------------------------------------------------------ [2003-01-27 22:39:59] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ 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