From: Operating system: Linux, Slamd64 11.0 PHP version: 5.2.13 Package: GD related Bug Type: Bug Bug description:imagettftext left-aligns text inappropriately
Description: ------------ When rotating text, imagettftext() aligns all of the letters and characters to be flush with the left-hand side of their box. Under many rotation conditions and particularly with punctuation that is not bottom-aligned (apostrophes, dashes) this is very unpleasant. The test script below demonstrates this very well. This appears similar to bug # 51263 but is in PHP 5.2.13 Test script: --------------- $image = imagecreatetruecolor(200,200); $white = imagecolorallocate($image,255,255,255); $black = imagecolorallocate($image,0,0,0); $font = '/home/customers/tnassoc/public_html/php-library/fonts/arial.ttf'; imagefill($image, 0, 0, $white); imagettftext($image, 10, -90, 50, 80, $black, $font, "Clock-Un'Wise" ); imagettftext($image, 10, 90, 150, 100, $black, $font, "Counter-O'Clock" ); imagettftext($image, 10, 0, 20, 20, $black, $font, "Normal-Text" ); header('Content-type: image/png'); imagepng($image); Expected result: ---------------- Three sets of words: 0. Normal-Text should appear normal left-to-right. 1. Clock-Un'Wise should be rotated 90 degrees right, and otherwise be normal and readable. 2. Counter-O'Clock should be rotated 90 degrees left, and otherwise be normal and readable. Actual result: -------------- 0. Unrotated text is fine. 1. All characters are shifted to the left, aligned to the bottom of the text. This includes the apostrophe and dash, with very unpleasant results. 2. All characters are shifted to the left, aligned to the top of the text. The dash is now at the top of the text instead of the middle, and the letters don't line up anymore. -- Edit bug report at http://bugs.php.net/bug.php?id=51352&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51352&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51352&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51352&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51352&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51352&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51352&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51352&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51352&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51352&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51352&r=support Expected behavior: http://bugs.php.net/fix.php?id=51352&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51352&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51352&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51352&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51352&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51352&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51352&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51352&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51352&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51352&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51352&r=mysqlcfg