【发布时间】:2020-06-29 12:27:19
【问题描述】:
我正在尝试像这样在 Php 7.4.7 中加载 .otf 字体:
- 添加根据日志看起来可行的资源路径:
$pdflib = new pdflib();
$pdflib->set_option('textformat=utf8');
$pdflib->set_option('SearchPath={{fullpath/to/my/fonts}}');
日志显示到目前为止没有错误:
[New category:resource "SearchPath:fullpath/to/my/fonts"]
- 但是当像这样加载字体时:
$font = $pdflib->load_font("My-Font-Regular", "unicode", "embedding");
我收到此错误:
[Last exception 2516 in load_font]["Font 'My-Font-Regular' with encoding 'unicode': Font file (AFM, PFM, TTF, OTF etc.) or host font not found"]
我尝试过 utf-8 作为编码,在添加搜索路径和加载字体时提供完整路径,在设置搜索路径时提供单花括号和双花括号,但我可以取得更多进展。
也试过没有成功:
$pdflib->set_option("stringformat=utf8");
我找不到任何关于可接受的编码的文档以及它甚至没有在 pdflib 提供的文档中描述的功能。
任何帮助将不胜感激。
【问题讨论】: