From: Takeshi Abe Date: Fri, 8 Jan 2010 12:18:52 +0000 (+0000) Subject: Bug #49600 (imageTTFText text shifted right) X-Git-Tag: php-5.4.0alpha1~468 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c18d4364ed0c16ff784418d9f0c54af9701c9d5a;p=php Bug #49600 (imageTTFText text shifted right) - fix difference of horizontal position between imagettftext() and imagettfbbox() --- diff --git a/NEWS b/NEWS index 14f25fa018..b95311040a 100644 --- a/NEWS +++ b/NEWS @@ -163,6 +163,7 @@ PHP NEWS ini variables). (Jani) - Fixed bug #49660 (libxml 2.7.3+ limits text nodes to 10MB). (Felipe) - Fixed bug #49647 (DOMUserData does not exist). (Rob) +- Fixed bug #49600 (imageTTFText text shifted right). (Takeshi Abe) - Fixed bug #49521 (PDO fetchObject sets values before calling constructor). (Pierrick) - Fixed bug #49472 (Constants defined in Interfaces can be overridden). diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index ac2bf344ff..a3ced0ab1b 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -1101,7 +1101,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi /* 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 */ diff --git a/ext/gd/tests/bug49600.phpt b/ext/gd/tests/bug49600.phpt new file mode 100644 index 0000000000..068f8f36a8 --- /dev/null +++ b/ext/gd/tests/bug49600.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #49600 (imageTTFText text shifted right) +--SKIPIF-- + +--FILE-- + 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