使用 php 打开 OTF 字体 - 包括希腊字符

发布于 2024-12-24 03:53:12 字数 255 浏览 3 评论 0原文

因此,正如标题所示,我的任务是将给定的短语转换为服务器端 (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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我早已燃尽 2024-12-31 03:53:12

Use imagefttext function instead. It has the same arguments and usage as imagettftext, 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.

杀手六號 2024-12-31 03:53:12

发布粗略的答案,似乎对未来遇到这篇文章的人有用:

解决方案似乎是:
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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文