centos7安装字体和中文字体

1.查看自己的操作系统

加粗样式[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

2. 安装字体库

[root@localhost ~]# yum install fontconfig

Package fontconfig-2.13.0-4.3.el7.x86_64 already installed and latest version
Nothing to do

3.安装更新字体命令

[root@localhost ~]# mkfontscale
-bash: mkfontscale: command not found
如果该命令没有需要安装
[root@localhost ~]# yum install mkfontscale

[root@localhost ~]# mkfontscale

4.查看中文字体

[root@localhost ~]# fc-list :lang=zh
一般情况是没有的

5.新建目录

[root@localhost ~]# ls
anaconda-ks.cfg fonts.scale jdk-8u333-linux-x64.tar.gz node-v14.13.1-linux-x64 node-v14.13.1-linux-x64.tar test
[root@localhost ~]# fc-list
可以看到很多字体但是没有中文
[root@localhost ~]# cd usr/share/fonts
-bash: cd: usr/share/fonts: No such file or directory
[root@localhost ~]# cd /usr/share/fonts
[root@localhost fonts]# ls
dejavu liberation
[root@localhost fonts]# mkdir chinese
[root@localhost fonts]# ls
chinese dejavu liberation
[root@localhost fonts]# ls
chinese dejavu liberation
[root@localhost fonts]# pwd
/usr/share/fonts
[root@localhost fonts]# cd chinese/

6.拷贝 fonts.scale 和windows上的字体到chinese文件夹中.将字体文件放在chinese目录

在这里插入图片描述

[root@localhost chinese]# cd ~
[root@localhost ~]# cp fonts.scale /usr/share/fonts/chinese/

7.授权,该目录及其下所有文件需要有执行权限

[root@localhost chinese]# sudo chmod -R 755 /usr/share/fonts/chinese

8.重新建立字体索引、更新缓存

cd /usr/share/fonts/Chinese
[root@localhost chinese]# mkfontscale
[root@localhost chinese]# mkfontdir
[root@localhost chinese]# fc-cache
[root@localhost chinese]#

9.查看字体是否安装成功,列出所有成功安装的字体

[root@localhost chinese]# fc-list :lang=zh
fc-list :lang=zh 注意冒号前有空格!

在这里插入图片描述


大功告成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

怒放de生命2010

您的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值