c4rt1y

centos7字体库安装

0x01 介绍

线上centos默认安装的是简洁版的服务器,里面可能缺少一些字体,比如中文字体等等。

0x02 环境安装与使用

# 安装软件
[root@centos-1 ]$sudo rpm -qa | grep fontconfig || sudo yum install fontconfig -y

# 此时,会出现 /usr/share/fonts 和 /usr/share/fontconfig 文件夹

# 关注 /etc/fonts/fonts.conf
[root@centos-1 ]$cat /etc/fonts/fonts.conf
...
<!-- Font directory list -->

<dir>/usr/share/fonts</dir>
<dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir> <dir>/usr/local/share/fonts</dir>
<dir prefix="xdg">fonts</dir>
<!-- the following element will be removed in the future -->

# 在这里会提示,服务器自动读取  /usr/share/fonts 、 /usr/share/X11/fonts/Type1 、/usr/share/X11/fonts/TTF 、/usr/local/share/fonts 目录下的字体进行导入,所以我们只需要将字体加入到当前这几个目录就可以,也可以修改fonts.conf文件,新增加一个目录

# 下载字体
[root@centos-1 ]$ wget xxx

# 更新缓存
[root@centos-1 ]$ fc-cache

# 查看字体
[root@centos-1 ]$fc-list | grep Arial
/usr/share/fonts/Arial Black.ttf: Arial Black:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta

# 此时加载成功了

0x03 资料来源

https://blog.csdn.net/wlwlwlwl015/article/details/51482065
GoTop