centos7 下安装 LibreOffice SpringBoot实现Word转PDF (字体安装篇--二)

1. 获取字体

windows系统中 C:\Windows\Fonts处获取字体文件

simsun.ttc 宋体

simhei.ttf 黑体

msyh.ttf 微软雅黑

msyhbd.ttf 微软雅黑

如果不添加字体,转出的pdf文件会出现方框

2. 新建文件夹

linux   /usr/share/fonts下新建文件夹CustomizedFonts 可以自定义

windows获取的字体放入自定义文件夹中

注意:

如果在/usr/share没有fonts文件夹 就需要使用yum -y install fontconfig进行安装

yum -y install fontconfig

修改文件夹权限

chmod -R 755 /usr/share/fonts/CustomizedFonts

3. 安装ttmkfdir

安装ttmkfdir来搜索目录中所有的字体信息,并汇总生成fonts.scale文件,输入命令

yum -y install ttmkfdir

修改字体配置文件

vi /etc/fonts/fonts.conf

增加一行,如下图所示

<dir>/usr/share/fonts/CustomizedFonts</dir>

4. 刷新信息

fc-cache

5. 校验是否安装成功

使用fc-list查看,已安装成功

猜你喜欢

转载自www.cnblogs.com/hg-super-man/p/11453053.html