Possible bug with imagettftext and imageft text when imagealphablending is false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have been attempting to write a dynamic text replacement script that would generate transparent PNGs using gd, and it works fine except when one of the characters in a font has parts of it that overhang into the previous characters. You can see what I mean in this test script:

<?php
$img = imagecreatetruecolor(200, 200);
imagealphablending($img, false);
$trans = imagecolortransparent($img);
imagefilledrectangle($img, 0, 0, 400, 400, $trans);
$green = imagecolorallocate($img, 6, 68, 0);
imagettftext($img, 30, 0, 10, 50, $green, "carolingia.ttf", "Linux");
header("Content-type: image/png");
imagesavealpha($img, true);
imagepng($img);
imagedestroy($img);
?>

The result can be seen at http://ethilien.net/tests/text.php
When you compare the text with what it should look like when I comment out the imagealphablending($img, false); line here http://ethilien.net/tests/text2.php you can see that the end of the 'u' is cut off.

I think that this is because the lower-left slash of the 'x' overlaps it and causes it to be overwritten.

This might be a bug in GD and not PHP, but I wanted to see if anyone has encountered this problem before or if I'm just not doing something right.

Thanks,

-Connor McKay

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux