PHP imagettftext: bounding boxes of letters superimpose above each other

拟墨画扇 提交于 2019-12-11 18:27:55

问题


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.

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:


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.



来源:https://stackoverflow.com/questions/2524655/php-imagettftext-bounding-boxes-of-letters-superimpose-above-each-other

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!