Edit report at http://bugs.php.net/bug.php?id=51207&edit=1

 ID:               51207
 User updated by:  penkert at yahoo dot com
 Reported by:      penkert at yahoo dot com
 Summary:          imageTTFText: misalignment of characters which extend
                   beyond their left margin
 Status:           Open
 Type:             Bug
 Package:          GD related
 Operating System: Linux & Windows XP
 PHP Version:      5.2.13

 New Comment:

BTW, about my Win32 testbed:



PHP 5.2.11, GD bundled (2.0.34 compatible), FreeType 2.1.9 => OK



PHP 5.2.13, GD bundled (2.0.34 compatible), FreeType 2.1.9 => buggy
result





Debian production system:



PHP 5.2.13, GD bundled (2.0.34 compatible), FreeType 2.2.1 => buggy
result



(can't go back to older PHP version there)


Previous Comments:
------------------------------------------------------------------------
[2010-03-06 19:44:06] penkert at yahoo dot com

I had a look at those two bugs before writing up my report. In fact,
their seem to be quite a number of similar bugs concerning imageTTFText.
But the thing is that the bug I'm describing was not present in PHP
5.2.11. So, even though all of these bugs are probably related in some
way or other I decided they can't actually be one and the same.

------------------------------------------------------------------------
[2010-03-06 18:54:27] sks76543210 at gmail dot com

Looks like a duplicate of bug #50194 and bug #50958

------------------------------------------------------------------------
[2010-03-05 02:34:22] penkert at yahoo dot com

Sorry, I forgot to mention I'm talking about PHP's imageTTFText
function.



And also, while previewing and editing my report the part of my last
paragraph after the apostrophe got lost. So here it is again:



My little test script spells out the word "Information" in "Pirouette
Text". In this font the letter "f" (among others) is made up of a large
S-like curve extending well into its neighboring letters' "territories".
PHP 5.2.11 places the "f" correctly. PHP 5.2.13, on the other hand,
seems to use the character's leftmost extremum for positioning it next
to the previous character which is, of course, incorrect. There are a
few more minor differences between the two PHP version's results----all
in favor of 5.2.11.

------------------------------------------------------------------------
[2010-03-05 01:28:10] penkert at yahoo dot com

Description:
------------
The following bug is present in PHP 5.2.13 and was not present in PHP
5.2.11. (It was probably introduced while attempting to solve Bug
#49600.) My test bed is Windows XP/Apache 2.0, production site runs on
Linux/Apache 1.3, both are showing the same symptom.



We are using the commercial font "Pirouette Text" by Linotype which I
obviously cannot include in this report. What sets this font apart from
most other fonts is the fact that some characters extend horizontally
beyond their bounding boxes in terms of character placement.



My little test script spells out the word "Information" in "Pirouette
Text". In this font the letter "f" (among others) is made up of a large
S-like curve extending well into its neighboring letters

Test script:
---------------
$text = "Information";

$font = "pirouette.otf";

$size = 41;



$dim = imagettfbbox($size, 0, $font, $text);

$off_y = -$dim[7];

$off_x = -$dim[0];

$img_h = $dim[1]+$off_y+1;

$img_w = $dim[2]+$off_x+2;

unset($dim);



$img = imagecreatetruecolor($img_w, $img_h);

imagefilledrectangle($img, 0, 0, $img_w-1, $img_h-1, 0xFFFFFF);

imagettftext($img, $size, 0, $off_x, $off_y, 0x000000, $font, $text);

header("Content-Type: image/gif");

imagetruecolortopalette($img, false, 32);

imagegif($img);

imagedestroy($img);

Expected result:
----------------
This is what it should look like (rendered by PHP 5.2.11):

http://mitglieder.hrc1880.de/penkert/php5_2_11.gif

Actual result:
--------------
And this is how PHP 5.2.13 messes it up:

http://mitglieder.hrc1880.de/penkert/php5_2_13.gif


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51207&edit=1

Reply via email to