20201129为linux增加字体库

Nov 29, 2020

20201129

为linux 增加字体库

原因是gotenberg生成勘验文档的PDF 库缺少字体库。

原issue 是要加open-sans, 但是我们要仿宋. 原issue做法:

1
2
deb http://httpredir.debian.org/debian/ unstable stretch main contrib non-free
apt-get update && apt-get install -y fonts-open-sans

或者做法二:

1
2
3
4
5
6
7
apt-get install unzip
wget https://fonts.google.com/download?family=Open%20Sans > fonts.zip
unzip ./fonts.zip
mkdir /usr/share/fonts/opensans
mv ./OpenSans-Light.ttf /usr/share/fonts/opensans/
fc-cache -fv
fc-list |grep opensans

但是,俺们要仿宋.

做法,先去下个仿宋的字体包: simfang.ttf.

技术人,github.com/search?q=simfang.ttf : https://github.com/21wmd/ttf-simfang/blob/master/usr/share/fonts/truetype/sim/simfang.ttf

下载好后:

1
2
3
4
1. 复制该字体到linux /usr/share/fonts/
2. fc-cache /usr/share/fonts/
3. fc-cache -fv
4. fc-list |grep fang # /usr/share/fonts/simfang.ttf: FangSong,仿宋:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta

成功!