#49600 [Opn->Asn]: imageTTFText text shifted right 5.2.10 & 5.2.11
| From: | pajoye@php.net | Date: | Sat, 19 Sep 2009 17:49:44 +0000 |
| Subject: | #49600 [Opn->Asn]: imageTTFText text shifted right 5.2.10 & 5.2.11 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-142573@lists.php.net to get a copy of this message | ||
ID: 49600
Updated by: pajoye@php.net
Reported By: ch+php at 1111-internet dot com
-Status: Open
+Status: Assigned
Bug Type: GD related
Operating System: FreeBSD 7.0
PHP Version: 5.2.11
-Assigned To:
+Assigned To: tabe
New Comment:
Tabe, can you take a look at this bug please? The only change in this
area was the latest patch about bbox.
Previous Comments:
------------------------------------------------------------------------
[2009-09-19 17:34:59] ch+php at 1111-internet dot com
Here's the correct result produced by the same code example with
5.2.9:
http://www.1111-internet.com/images/php5_2_9_gdft_hpos.png
------------------------------------------------------------------------
[2009-09-19 15:47:15] ch+php at 1111-internet dot com
Description:
------------
imageTTFText appears to have an issue with horizontal positioning of
characters. This was introduced with 5.2.10 (which also had a vertical
positioning issue cited in Bug #48801) and continues with 5.2.11 (where
the vertical issue appears to have been corrected).
Nothing special in my config, but here it is just in case:
'./configure' '--prefix=/usr/local/php5'
'--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-track-vars'
'--with-mysql=/usr/local/mysql' '--with-gd'
'--with-zlib-dir=/usr/local'
'--enable-zip' '--with-freetype-dir=/usr/local'
'--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local'
'--with-tiff-dir=/usr/local' '--with-mcrypt=/usr/local'
'--with-pdflib=/usr/local' '--with-curl=/usr/local' '--enable-ftp'
'--without-iconv' '--without-pear'
Reproduce code:
---------------
$image=imagecreatetruecolor(401, 51);
imagefill($image, 0, 0, imagecolorallocate($image, 255, 255, 255));
list($fontcolor, $outlinecolor,
$gridcolor)=array(imagecolorallocate($image, 0, 0, 0),
imagecolorallocatealpha($image, 255, 0, 0, 64),
imagecolorallocate($image, 222, 255, 255));
for ($x=0; $x<=imagesx($image)-1; $x+=5) {imageline($image, $x, 0, $x,
imagesy($image)-1, $gridcolor);}
for ($y=0; $y<=imagesy($image)-1; $y+=5) {imageline($image, 0, $y,
imagesx($image)-1, $y, $gridcolor);}
foreach (array(array("face"=>"arial", "text"=>"E"),
array("face"=>"arial", "text"=>"I"),
array("face"=>"arial",
"text"=>"P"), array("face"=>"arial",
"text"=>"g"),
array("face"=>"arial", "text"=>"i"),
array("face"=>"arial",
"text"=>"q"), array("face"=>"wingdng2",
"text"=>""),
array("face"=>"webdings", "text"=>"")) as
$index=>$array)
{
list($xl, $yb, $xr, $yb2, $xr2, $yt)=imagettftext($image, 32, 0,
10+$index*50, 36, $fontcolor, "/www/fonts/". $array["face"]. ".ttf",
$array["text"]);
imagerectangle($image, $xl, $yt, $xr, $yb, $outlinecolor);
}
header("Content-Type: image/png");
imagepng($image);
imagedestroy($image);
exit;
Expected result:
----------------
characters should fit neatly inside the rectangle outlines drawn using
the return values from imagettftext, and should left align to the $x
parameter of imagettftext
Actual result:
--------------
http://www.1111-internet.com/images/php5_2_11_gdft_hpos.png
outline rectangles appear to be correct sizes and positions, but
characters are often shifted right
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49600&edit=1