pajoye                                   Wed, 03 Feb 2010 17:41:00 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=294423

Log:
- Merge #49600 (imageTTFText text shifted right)

Bug: http://bugs.php.net/49600 (No Feedback) imageTTFText text shifted right
      
Changed paths:
    U   php/php-src/branches/PHP_5_3_2/ext/gd/libgd/gdft.c
    A + php/php-src/branches/PHP_5_3_2/ext/gd/tests/bug49600.phpt
        (from php/php-src/branches/PHP_5_3/ext/gd/tests/bug49600.phpt:r293268)

Modified: php/php-src/branches/PHP_5_3_2/ext/gd/libgd/gdft.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/gd/libgd/gdft.c  2010-02-03 17:32:48 UTC 
(rev 294422)
+++ php/php-src/branches/PHP_5_3_2/ext/gd/libgd/gdft.c  2010-02-03 17:41:00 UTC 
(rev 294423)
@@ -1101,7 +1101,7 @@

                        /* now, draw to our target surface */
                        bm = (FT_BitmapGlyph) image;
-                       gdft_draw_bitmap(tc_cache, im, fg, bm->bitmap, x + x1 + 
((pen.x + 31) >> 6) + bm->left, y + y1 + ((pen.y + 31) >> 6) - bm->top);
+                       gdft_draw_bitmap(tc_cache, im, fg, bm->bitmap, x + x1 + 
((pen.x + 31) >> 6), y + y1 + ((pen.y + 31) >> 6) - bm->top);
                }

                /* record current glyph index for kerning */

Copied: php/php-src/branches/PHP_5_3_2/ext/gd/tests/bug49600.phpt (from rev 
293268, php/php-src/branches/PHP_5_3/ext/gd/tests/bug49600.phpt)
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/gd/tests/bug49600.phpt                   
        (rev 0)
+++ php/php-src/branches/PHP_5_3_2/ext/gd/tests/bug49600.phpt   2010-02-03 
17:41:00 UTC (rev 294423)
@@ -0,0 +1,32 @@
+--TEST--
+Bug #49600 (imageTTFText text shifted right)
+--SKIPIF--
+<?php
+       if(!extension_loaded('gd')){ die('skip gd extension not available'); }
+       if(!function_exists('imagettftext')) die('skip imagettftext() not 
available');
+       if(!function_exists('imagettfbbox')) die('skip imagettfbbox() not 
available');
+?>
+--FILE--
+<?php
+$cwd = dirname(__FILE__);
+$font = "$cwd/Tuffy.ttf";
+$image = imagecreatetruecolor(50, 50);
+$color = imagecolorallocate($image, 255, 255, 255);
+foreach (array("E", "I", "P", "g", "i", "q") as $c)
+{
+    $x = imagettftext($image, 32, 0, 0, 0, $color, $font, $c);
+       $y = imagettfbbox(32, 0, "$cwd/Tuffy.ttf", $c);
+    if ( abs($x[0] - $y[0]) > 1
+      || abs($x[2] - $y[2]) > 1
+      || abs($x[4] - $y[4]) > 1
+      || abs($x[6] - $y[6]) > 1 ) {
+      echo "FAILED: \n";
+      var_dump($x);
+      var_dump($y);
+      exit;
+    }
+}
+echo 'OK';
+?>
+--EXPECTF--
+OK
\ No newline at end of file

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to