Edit report at http://bugs.php.net/bug.php?id=49600&edit=1
ID: 49600 Comment by: barts at hexon dot cx Reported by: ch+php at 1111-internet dot com Summary: imageTTFText text shifted right Status: Closed Type: Bug Package: GD related Operating System: FreeBSD 7.0 PHP Version: 5.2.11 Assigned To: tabe Block user comment: N New Comment: The fix for this bug was reverted in revision 296693, which fixed bug #51263. Re-applying the patch for this bug will break the alignment of angled text, so another solution is required. Test script: <?php $expected = imagettfbbox(24, 0, 'courier', 'Foobar'); $img = imagecreatetruecolor(100, 100); $color = imagecolorallocate($img, 0, 0, 0); $actual = imagettftext($img, 24, 0, 0, 0, $color, 'courier', 'Foobar'); var_dump($expected); var_dump($actual); ?> Expected: $expected equals $actual Actual result: array(8) { [0]=> int(-1) [1]=> int(-1) [2]=> int(108) [3]=> int(-1) [4]=> int(108) [5]=> int(-21) [6]=> int(-1) [7]=> int(-21) } array(8) { [0]=> int(0) [1]=> int(0) [2]=> int(109) [3]=> int(0) [4]=> int(109) [5]=> int(-20) [6]=> int(0) [7]=> int(-20) } Previous Comments: ------------------------------------------------------------------------ [2010-02-03 17:41:01] s...@php.net Automatic comment from SVN on behalf of pajoye Revision: http://svn.php.net/viewvc/?view=revision&revision=294423 Log: - Merge #49600 (imageTTFText text shifted right) ------------------------------------------------------------------------ [2010-01-08 12:18:53] s...@php.net Automatic comment from SVN on behalf of tabe Revision: http://svn.php.net/viewvc/?view=revision&revision=293268 Log: Bug #49600 (imageTTFText text shifted right) - fix difference of horizontal position between imagettftext() and imagettfbbox() ------------------------------------------------------------------------ [2009-09-25 05:00:53] ch+php at 1111-internet dot com Just noticed that the text positioning between the two examples is exactly the same - it's the bounding coordinates that changed. This suggests that in <=5.2.9 BOTH the text and the boxes were shifted right (which was less noticeable in practice since they were in sync - but a closer inspection of the 5.2.9 example does show this). The bounding coordinates are now where one would expect them to be, but that's not where the text is. ------------------------------------------------------------------------ [2009-09-19 17:49:44] paj...@php.net Tabe, can you take a look at this bug please? The only change in this area was the latest patch about bbox. ------------------------------------------------------------------------ [2009-09-19 17:34:59] ch+php at 1111-internet dot com Here's the correct result produced by the same code example with 5.2.9: http://www.1111-internet.com/images/php5_2_9_gdft_hpos.png ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=49600 -- Edit this bug report at http://bugs.php.net/bug.php?id=49600&edit=1