tabe Wed, 24 Mar 2010 04:12:19 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=296693
Log: Fixed bug #51263 (imagettftext and rotated text uses wrong baseline) Bug: http://bugs.php.net/51263 (Open) imagettftext and rotated text uses wrong baseline (regression) Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/ext/gd/libgd/gdft.c A php/php-src/branches/PHP_5_2/ext/gd/tests/bug51263.phpt U php/php-src/branches/PHP_5_3/ext/gd/libgd/gdft.c A php/php-src/branches/PHP_5_3/ext/gd/tests/bug51263.phpt U php/php-src/trunk/ext/gd/libgd/gdft.c A php/php-src/trunk/ext/gd/tests/bug51263.phpt Modified: php/php-src/branches/PHP_5_2/NEWS =================================================================== --- php/php-src/branches/PHP_5_2/NEWS 2010-03-23 23:39:09 UTC (rev 296692) +++ php/php-src/branches/PHP_5_2/NEWS 2010-03-24 04:12:19 UTC (rev 296693) @@ -12,6 +12,8 @@ - Fixed bug #51338 (URL-Rewriter is still enabled if use_only_cookies is on). (Ilia, j dot jeising at gmail dot com) - Fixed bug #51269 (zlib.output_compression Overwrites Vary Header). (Adam) +- Fixed bug #51263 (imagettftext and rotated text uses wrong baseline) + (cschneid at cschneid dot com, Takeshi Abe) - Fixed bug #51237 (milter SAPI crash on startup). (igmar at palsenberg dot com) - Fixed bug #51213 (pdo_mssql is trimming value of the money column). (Ilia, alexr at oplot dot com) Modified: php/php-src/branches/PHP_5_2/ext/gd/libgd/gdft.c =================================================================== --- php/php-src/branches/PHP_5_2/ext/gd/libgd/gdft.c 2010-03-23 23:39:09 UTC (rev 296692) +++ php/php-src/branches/PHP_5_2/ext/gd/libgd/gdft.c 2010-03-24 04:12:19 UTC (rev 296693) @@ -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), y + y1 + ((pen.y + 31) >> 6) - bm->top); + 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); } /* record current glyph index for kerning */ Added: php/php-src/branches/PHP_5_2/ext/gd/tests/bug51263.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/gd/tests/bug51263.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/gd/tests/bug51263.phpt 2010-03-24 04:12:19 UTC (rev 296693) @@ -0,0 +1,32 @@ +--TEST-- +Bug #51263 (imagettftext and rotated text uses wrong baseline) +--SKIPIF-- +<?php + if(!extension_loaded('gd')){ die('skip gd extension not available'); } + if(!function_exists('imagettftext')) die('skip imagettftext() not available'); +?> +--FILE-- +<?php +$cwd = dirname(__FILE__); +$ttf = "$cwd/Tuffy.ttf"; +$w = 23; +$h = 70; +$img = imagecreatetruecolor($w, $h); +$blk = imagecolorallocate($img, 0, 0, 0); +imagefilledrectangle($img, 0, 0, $w-1, $h-1, $blk); +$col = imagecolorallocate($img, 255, 255, 255); +imagettftext($img, 8, 90, 10, 60, $col, $ttf, "foo bar qux"); +$x = array(0, 1, 2, 3, 13); +for ($j=0; $j<30; $j++) { + foreach ($x as $i) { + $c = imagecolorat($img, $i, $j); + if ($c != 0) { + echo "KO: ($i, $j)\n"; + exit; + } + } +} +echo "OK\n"; +?> +--EXPECTF-- +OK Modified: php/php-src/branches/PHP_5_3/ext/gd/libgd/gdft.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/gd/libgd/gdft.c 2010-03-23 23:39:09 UTC (rev 296692) +++ php/php-src/branches/PHP_5_3/ext/gd/libgd/gdft.c 2010-03-24 04:12:19 UTC (rev 296693) @@ -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), y + y1 + ((pen.y + 31) >> 6) - bm->top); + 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); } /* record current glyph index for kerning */ Added: php/php-src/branches/PHP_5_3/ext/gd/tests/bug51263.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/gd/tests/bug51263.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/gd/tests/bug51263.phpt 2010-03-24 04:12:19 UTC (rev 296693) @@ -0,0 +1,32 @@ +--TEST-- +Bug #51263 (imagettftext and rotated text uses wrong baseline) +--SKIPIF-- +<?php + if(!extension_loaded('gd')){ die('skip gd extension not available'); } + if(!function_exists('imagettftext')) die('skip imagettftext() not available'); +?> +--FILE-- +<?php +$cwd = dirname(__FILE__); +$ttf = "$cwd/Tuffy.ttf"; +$w = 23; +$h = 70; +$img = imagecreatetruecolor($w, $h); +$blk = imagecolorallocate($img, 0, 0, 0); +imagefilledrectangle($img, 0, 0, $w-1, $h-1, $blk); +$col = imagecolorallocate($img, 255, 255, 255); +imagettftext($img, 8, 90, 10, 60, $col, $ttf, "foo bar qux"); +$x = array(0, 1, 2, 3, 13); +for ($j=0; $j<30; $j++) { + foreach ($x as $i) { + $c = imagecolorat($img, $i, $j); + if ($c != 0) { + echo "KO: ($i, $j)\n"; + exit; + } + } +} +echo "OK\n"; +?> +--EXPECTF-- +OK Modified: php/php-src/trunk/ext/gd/libgd/gdft.c =================================================================== --- php/php-src/trunk/ext/gd/libgd/gdft.c 2010-03-23 23:39:09 UTC (rev 296692) +++ php/php-src/trunk/ext/gd/libgd/gdft.c 2010-03-24 04:12:19 UTC (rev 296693) @@ -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), y + y1 + ((pen.y + 31) >> 6) - bm->top); + 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); } /* record current glyph index for kerning */ Added: php/php-src/trunk/ext/gd/tests/bug51263.phpt =================================================================== --- php/php-src/trunk/ext/gd/tests/bug51263.phpt (rev 0) +++ php/php-src/trunk/ext/gd/tests/bug51263.phpt 2010-03-24 04:12:19 UTC (rev 296693) @@ -0,0 +1,32 @@ +--TEST-- +Bug #51263 (imagettftext and rotated text uses wrong baseline) +--SKIPIF-- +<?php + if(!extension_loaded('gd')){ die('skip gd extension not available'); } + if(!function_exists('imagettftext')) die('skip imagettftext() not available'); +?> +--FILE-- +<?php +$cwd = dirname(__FILE__); +$ttf = "$cwd/Tuffy.ttf"; +$w = 23; +$h = 70; +$img = imagecreatetruecolor($w, $h); +$blk = imagecolorallocate($img, 0, 0, 0); +imagefilledrectangle($img, 0, 0, $w-1, $h-1, $blk); +$col = imagecolorallocate($img, 255, 255, 255); +imagettftext($img, 8, 90, 10, 60, $col, $ttf, "foo bar qux"); +$x = array(0, 1, 2, 3, 13); +for ($j=0; $j<30; $j++) { + foreach ($x as $i) { + $c = imagecolorat($img, $i, $j); + if ($c != 0) { + echo "KO: ($i, $j)\n"; + exit; + } + } +} +echo "OK\n"; +?> +--EXPECTF-- +OK
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php