views:

146

answers:

2

I'm writing text-images on the fly with PHPs imagettftext, which works fine so far, but I have a very strange problem.

We are using a very italicized font and apparently the bounding boxes of later letters are sometimes superimposing their background over previous letters, thus cutting into them.

A screenshot of the effect can be seen here

Now, I can't seem to find a way to tell imagettftext to use a transparent background for the font (for the image itself it's not a problem).

So, anyone has an suggestion how to get rid of those cuts? Or will we have to use a less italicized font?

+1  A: 

Ha, found the solution right after posting the question.

I had user imagealphablending($image, false) to get a transparent background. When turning it back on right before applying the text, it works just fine.

Sorcy
A: 

Glad you found it. ALthough imagesavealpha($image, true); requires imagealphablending($image, false); I guess you can later on turn on alphablending. Anyway, glad you found this, it certainly isn't mentioned in the online PHP manual as far as I know.