Linux CentOS 7 安装字体库 & 中文字体
前言
[root@localhost /]# fc-list -bash: fc-list: command notfound
安装字体库
yum -y install fontconfig
当看到下图的提示信息时说明已安装成功:
Installed: fontconfig.x86_64 0:2.10.95-7.el7 Dependency Installed: fontpackages - filesystem.noarch 0:1.44-8.el7 Complete!
这时在/usr/shared目录就可以看到fonts和fontconfig目录了(之前是没有的):
接下来就可以给我们的字体库中添加中文字体了。
添加中文字体
[root@localhost share]# cd fonts/ [root@localhost fonts]# ls [root@localhost fonts]# mkdir chinese [root@localhost fonts]# ls Chinese [root@localhost fonts]# □
chmod -R 755 /usr/share/fonts/chinese
yum -y install ttmkfdir
Running transaction Installing : ttmkfdir-3.0.9-42.el7,x86_64 Verifying : ttmkfdir-3.0.9-42.el7,x86_64 Installed: ttmkfdir.x86_64 0:3.0.9-42,el7 Complete!
ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir
vi /etc/fonts/fonts.conf
<!-- Font directory list --> <dir>/usr/share/fonts</dir> <dir>/usr/share/Xll/fonts/Typel</dir> <dir>/usr/share/Xll/fonts/TTF</dir> <dir>/usr/share/fonts</dir> <dir>/usr/share/fonts/chinese</dir> <dir prefix="xdg">fonts</dir> <!-- the following element will be removed in the future --> <dir>~/.fonts</dir>
fc-cache
这样所有的步骤就算完成了,最后再次通过fc-list看一下字体列表:
[root(alocalhost share]# fc-list /usr/share/fonts/chinese/simsun.ttc:NSimSun,新来体:style=Regular /usr/share/fonts/chinese/simhei.ttf:SimHei,黑体:style=Regular,Normal, obycejne, /usr/share/fonts/chinese/simsun.ttc:SimSun,宋体:style=Regular
总结
来源:https://blog.csdn.net/wlwlwlwl015/article/details/51482065