Cutycapt、wkhtmltopdf、wkhtmltoimage、phantomjs 无法正确显示字符
他们显示的唯一字符是英文字符。
打印页面的布局是应该的,但唯一错误的是英语(罗马)以外的任何脚本中的字符被替换为方框。
我已经安装了 xvfb 和字体,但它仍然给我下面的错误
FreeFontPath: FPE "/usr/share/X11/fonts/misc" refcount is 2, should be 1; fixing.
现在,另一个错误也开始随机出现
FreeFontPath: FPE "/usr/share/X11/fonts/misc" refcount is 2, should be 1; fixing.
error opening security policy file /usr/lib64/xserver/SecurityPolicy
我花了一整天的时间试图修复这些错误,但我只是感到沮丧。
我正在运行 centos (Linux 2.6.18-274.7.1.el5xen #1 SMP Thu Oct 20 17:06:34 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux)
The only characters they are displaying are the English ones.
The layout of the printed page is as it should be, but the only thing that is wrong is the characters in any script other than english (roman) being replaced with boxes.
I have already installed xvfb and the fonts and it is still giving me the error below
FreeFontPath: FPE "/usr/share/X11/fonts/misc" refcount is 2, should be 1; fixing.
Now, another error has also started to come up randomly
FreeFontPath: FPE "/usr/share/X11/fonts/misc" refcount is 2, should be 1; fixing.
error opening security policy file /usr/lib64/xserver/SecurityPolicy
I have spent the whole day trying to fix these errors and I am just getting frustrated.
I am running centos (Linux 2.6.18-274.7.1.el5xen #1 SMP Thu Oct 20 17:06:34 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此错误通常是由“缺少”字体引起的。
wkhtmltopdf
有时即使正确安装了字体也无法检测到字体(这在 *nix 系统上尤其普遍)。我的解决方案是对字体进行 Base64 编码(您可以使用此工具)并将其包含在您的 CSS 中:
这保证了交叉平台兼容性,并且您不必在您使用的所有不同系统(开发、测试登台、生产等)上安装字体。
This error is often caused by "missing" fonts.
wkhtmltopdf
sometimes fails to detect fonts even when they are properly installed (this is especially prevalent on *nix systems).My solution is to Base64 encode the font (you can use this tool) and include it in your CSS:
This guarantees cross-platform compatibility, and you don't have to instal fonts on all the different systems you're using (development, testing staging, production, etc).