支持 php imagettftext 所有 utf-8 字符的字体
我在 php 中使用 imagettftext 来生成图像。有没有支持所有utf-8字符的true type字体?
I'm using imagettftext in php to generate images. Is there a true type font that supports all utf-8 characters?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 Brian Neal 在他的评论中所说,UTF-8 只是可以表示 Unicode 字符集中的每个字符的几种编码标准之一,目前该标准包含超过 100000 个条目。
因此,您实际上需要一种 true type 字体,支持当前在这个星球上使用的所有 100k+ unicode 字符(并且它是一个移动目标,因为该集合不断扩展和调整)。
所以我想字面答案是否定的,您应该检查您的前提条件(在您的用例中可能遇到哪些字符子集),并搜索合适的多用途字体。
不过,有人尝试提供覆盖大量 unicode 空间的字体 - search 'Pan-Unicode Fonts' 以获取概述。
☕(U+2615 - '热饮';)
As Brian Neal stated in his comments, UTF-8 is just one of several encoding standards that can represent every character in the Unicode character set, which currently contains more than 100000 entries.
So you are actually asking for a true type font that supports all 100k+ unicode characters currently in use on this planet (and it's a moving target, as the set gets expanded and adjusted constantly).
So I guess the literal answer is no, and you should probably check your preconditions (what character subsets are likely encountered in your use case), and search for a fitting multi-purpose font.
However, there are attempts to provide fonts that cover large amounts of the unicode space - search for 'Pan-Unicode Fonts' to get an overview.
☕ (U+2615 - 'Hot Beverage' ;)
最接近的是 Google Noto 字体。
Sans 和 Serif 支持 582 种语言,而 Mono 支持 212 种语言。
链接和更多信息请参见:https://www.google.com/get/noto/
The closest you can get is Google Noto Fonts.
Sans and Serif support 582 languages while Mono supports 212 languages.
Link and more information here: https://www.google.com/get/noto/