PHP imagettftext:包围在一起的字母包围框 [英] PHP imagettftext: bounding boxes of letters superimpose above each other

查看:94
本文介绍了PHP imagettftext:包围在一起的字母包围框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHPs imagettftext即时编写文本图像,到目前为止效果很好,但是我遇到了一个非常奇怪的问题.

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.

现在,我似乎无法找到一种方法来告诉imagettftext使用透明背景作为字体(对于图像本身来说这不是问题).

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?

推荐答案

哈,在发布问题后立即找到了解决方案.

Ha, found the solution right after posting the question.

我让用户imagealphablending($ image,false)获得透明背景. 在应用文字之前将其重新打开时,效果很好.

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.

这篇关于PHP imagettftext:包围在一起的字母包围框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆