DOMPDF无法渲染字体,而是显示圆圈 [英] DOMPDF fails to render font, shows circles instead
问题描述
使用 load_font.php
脚本,确认字体文件被复制到 / dompdf / lib / fonts
,字体信息被添加到字体缓存文件中。将 font-family
包含到CSS文件中。
当我尝试呈现PDF时,字符。我做了一个截图,但是因为Adobe Reader在加载文件后崩溃了,所以我不能这样做。
- 从我上传的文件中,文件被复制到
/ dompdf / lib / fonts
而没有任何改变。 - DOMPDF字体缓存文件列出没有任何扩展名的字体名称。
这个问题很明显,它接着搜索TTF文件,假设是小写扩展名,而我上传的是大写,它们没有被重命名,因为服务器文件系统是区分大小写的,所以无法找到。
TL; DR 确保扩展名你已上传的字体文件全部是小写字母
Followed this guide: github.com/dompdf/dompdf/wiki/UnicodeHowTo
Used the load_font.php
script, confirmed the font files were copied to /dompdf/lib/fonts
and the font information was added to the fonts cache file. Included the font-family
to the CSS file.
When I try to render a PDF it shows me circles instead of characters. I'd make a screenshot, but I can't since Adobe Reader crashes right after loading the file.
- The files were copied to
/dompdf/lib/fonts
from wherever I uploaded them to without any changes. - The DOMPDF fonts cache file lists the font names without any extension.
The problem here was that apparently, it then searches for the TTF files assuming the lowercase extension, while the ones I uploaded were in uppercase, they were not renamed, and could not be found since the server file system is case-sensitive.
TL;DR make sure the extensions of the font files you've uploaded are all in lowercase
这篇关于DOMPDF无法渲染字体,而是显示圆圈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!