From 9a73e1c2bfa3bbcfe297ce6ecb72c6a47cdd6c57 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Fri, 8 Jan 2010 12:18:52 +0000 Subject: [PATCH] Bug #49600 (imageTTFText text shifted right) - fix difference of horizontal position between imagettftext() and imagettfbbox() --- ext/gd/libgd/gdft.c | 2 +- ext/gd/tests/bug49600.phpt | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 ext/gd/tests/bug49600.phpt 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 -- 2.40.0