Edit report at http://bugs.php.net/bug.php?id=51352&edit=1
ID: 51352
Updated by: [email protected]
Reported by: gregor at hostgis dot com
Summary: imagettftext left-aligns text inappropriately
-Status: Open
+Status: Duplicate
Type: Bug
Package: GD related
Operating System: Linux, Slamd64 11.0
PHP Version: 5.2.13
-Assigned To:
+Assigned To: tabe
New Comment:
Thanks for your report.
Reproduced, and this bug seems a duplicate of #51263.
Previous Comments:
------------------------------------------------------------------------
[2010-03-22 18:51:39] gregor at hostgis dot com
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 this bug report at http://bugs.php.net/bug.php?id=51352&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.