From:             ch+php at 1111-internet dot com
Operating system: FreeBSD 7.0
PHP version:      5.2.11
PHP Bug Type:     GD related
Bug description:  imageTTFText text shifted right 5.2.10 & 5.2.11

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"=>"&#61630;"),
array("face"=>"webdings", "text"=>"&#61476;")) 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 bug report at http://bugs.php.net/?id=49600&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49600&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49600&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49600&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49600&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49600&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49600&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49600&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49600&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49600&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49600&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49600&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49600&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49600&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49600&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49600&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49600&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49600&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49600&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49600&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49600&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49600&r=mysqlcfg

Reply via email to