Reply to Possible bug with imagettftext and imageft text when imagealphablending is false

Your name:

Reply:


Posted by Ethilien on 10/12/05 23:02

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация