|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-03-24 04:58 UTC] tabe@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: tabe
[2010-03-24 04:58 UTC] tabe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
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.