使用 php 打开 OTF 字体 - 包括希腊字符
因此,正如标题所示,我的任务是将给定的短语转换为服务器端 (php GD) 上选定的 .otf 字体的图像。该短语不仅可以包含拉丁字符,还可以包含希腊语和西里尔语。
PHP 的 imagettftext (http://php.net/manual/en/function.imagettftext.php) 不适用于 .otf 字体上的非拉丁字符(看起来可以与 .ttf 配合使用)。
有什么线索吗?
编辑:字体需要为.otf
So, as the title says, my task is to convert a given phrase to an image on server side (php GD) with a selected .otf font. The phrase can include not only latin characters but also greek and cyrillic.
PHP's imagettftext (http://php.net/manual/en/function.imagettftext.php) won't work with non-latin characters on .otf fonts (works ok with .ttf as it seems).
Any clues?
EDIT: Font needs to be .otf
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
imagefttext
函数 相反。它具有与 imagettftext 相同的参数和用法,但使用支持 OpenType 和许多其他字体格式的 FreeType 2 库。但它不支持 OpenType 的布局表。有关详细信息,请参阅 FreeType 2 常见问题解答。
Use
imagefttext
function instead. It has the same arguments and usage asimagettftext
, but uses the FreeType 2 library which supports OpenType and plenty of other font formats.It doesn't support OpenType's layout tables however. See FreeType 2's FAQ for more info.
发布粗略的答案,似乎对未来遇到这篇文章的人有用:
解决方案似乎是:
1)用LATEX服务器端打开OTF
2)生成PDF
3)使用ImageMagick库转换为图像。
Posting rough answer that seems to work for future people bumping on this post:
Solution seemed to be:
1) open OTF with LATEX server side
2) produce PDF
3) convert to image with ImageMagick library.