PHP 更新 imagettftext() 和 imagefttext() 函数的字距调整问题
我们的开发服务器最近升级到 PHP v5.2.13。通过这次升级,我们发现我们的 png 图像存在字距调整(字母间距)问题。我们尝试了多种字体,但尚未找到解决方案。
我们使用 GD 库创建图像,并使用字体文件和 imagettftext() 或 imagefttext() 函数将文本写入图像。
还有其他人遇到过这个吗?我是否误解了什么,或者应该将其作为错误提交给 PHP?有什么我还没有想到的很酷的解决方法吗?
这是新旧 tahoma 粗体的示例。其他字体(粗体和非粗体)也有同样的问题。有些字母和数字看起来像是偏离中心或类似的东西。
坏 - 新 PHP
好 - 旧 PHP v5.2.11 (用词略有不同,因为这是我们的开发服务器,另一个是实时服务器)
Our dev server was recently upgraded to PHP v5.2.13. With that upgrade we have found that our png images are having kerning (letter spacing) problems. We've tried numerous fonts and haven't found a solution yet.
We are creating images using the GD library and writing text to the images using font files and the imagettftext() or imagefttext() functions.
Has anyone else run into this? Am I misunderstanding something or should this be submitted to PHP as a bug? Are there any cool workarounds I haven't thought of yet?
Here's an example of the new and old tahoma bold. Other fonts (bold and non-bold) have the same problem. Some letters and numbers seem like they're off-center or something like that.
Bad - new PHP
Good - old PHP v5.2.11 (the words are slightly different because this is our dev server and the other one is the live server)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“跟踪”是一个类似的术语,表示文本设置的松紧程度。您可能会更好地通过谷歌搜索,例如 此结果。
"Tracking" is a similar term for how tight or loose text is set. You might have better luck googling for that, such as this result.
由于我们使用的字体,字距调整对我们不起作用,因此我们必须对特定字母组合(如 AV、AW 等)进行手动字距调整。
Kerning didn't work for us thanks to the font we used, so we had to put in manual kerning for specific letter combinations like AV, AW ...etc.