Linux Fonts / 字体支持
It's usually this case that we choose to install an OS in minimal
mode because it only costs little resource.
为了节约资源,我们常常会以最小化的形式全装一个系统。
If our environment is totally in EN, there won't be any mistake.
如果我们的系统只需要支持 英文环境, 那么一切都会OK。
Unfortunately, we have to do L10N, especially in Asia. Missing basic fonts would make whole result totally a mess.
但是,常常出现的情况是 我们要做本地化。 缺失基本的字体 会使得整个系统一团糟。
Recently I have encountered such a situation that the PDF report generated by phantomjs
cannot show Chinese character.
最近我遇到了一个问题就是,使用 phantomjs
去生成PDF 报告。但是这个报告却不能够呈现中文。
After I searched on Google and implemented some suggestions, I found that the following steps are the solutions.
其实很简单,只需要两个步骤就能解决这个问题。
1. Install fontconfig
/ 安装 fontconfig
However, I found it optional. Because I tried to ignore this step in a Docker environment, and found that it still works correctly.
不过这一步似乎是可选的,因为我们docker 环境下 忽略了这一步。
yum -y install fontconfig
2. Copy fonts / 拷贝字体
Find a fully installed OS and go to the corresponding folder /usr/shared/fonts
In this folder, we will see lots fonts:
从一个完整安装的系统上 去 拷贝对应的字体文件夹。 这个文件夹里面有很多的字体。
ls
abattis-cantarell lklug lohit-punjabi sil-abyssinica
cjkuni-uming lohit-assamese lohit-tamil sil-nuosu
default lohit-bengali lohit-telugu sil-padauk
dejavu lohit-devanagari madan smc
gnu-free lohit-gujarati nhn-nanum stix
google-crosextra-caladea lohit-kannada open-sans thai-scalable
google-crosextra-carlito lohit-malayalam opensymbol ucs-miscfixed
jomolhari lohit-marathi overpass vlgothic
khmeros lohit-nepali paktype-naskh-basic wqy-microhei
liberation lohit-oriya paratype-pt-sans wqy-zenhei
Copy them to new Env, things will work OK.
将这些字体拷贝到新的环境中,就能 渲染出正常的字体。
Reference: https://blog.csdn.net/wlwlwlwl015/article/details/51482065
Comments !