1 Star 0 Fork 29

tracese / notebook

forked from JustryDeng / notebook 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
[07]CentOS7增加系统字体.md 2.55 KB
一键复制 编辑 原始数据 按行查看 历史
邓沙利文 提交于 2022-08-09 16:00 . CentOS7增加系统字体

CentOS7增加系统字体

准备字体文件

  • 方式一:去windows(C:\Windows\Fonts)下找到想用的字体,复制并修改后缀名为ttc

    1660026012243

  • 方式二:去网上下载对应的ttc字体文件

CentOS7增加系统字体

第一步:查看已有字体

# 若提示指令不存在,则执行指令进行安装 yum -y install fontconfig
fc-list

注:安装了fontconfig后,在/usr/share目录可以查看到fonts 和fontconfig目录

1660026570159

第二步:将字体复制进linux对应目录

创建/usr/share/fonts/chinese目录

mkdir -p /usr/share/fonts/chinese
cd /usr/share/fonts/chinese

将字体文件放入/usr/share/fonts/chinese下

1660028192002

给该目录加 755 权限

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

1660028233313

第三步:安装ttmkfdir

ttmkfdir是用来搜索目录中所有的字体信息,并汇总生成fonts.scale文件的

# 安装ttmkfdir
yum -y install ttmkfdir
# 执行相关指令,搜索目录中所有的字体信息,并汇总生成fonts.scale文件的
ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir

1660028341051

第四步:修改字体配置文件,添加字体库文件夹

将字体目录/usr/share/fonts/chinese加入到/etc/fonts/fonts.conf配置文件,添加以下内容

编辑

vim /etc/fonts/fonts.conf

添加

<dir>/usr/share/fonts/chinese</dir>

添加完后可以查看一下

cat /etc/fonts/fonts.conf | grep -C3 chinese

1660028668322

第五步:刷新内存中的字体缓存

fc-cache
fc-list

可看到我们添加的字体【微软雅黑】已经成功添加进去了

1660028959705

1
https://gitee.com/Trace001/notebook.git
git@gitee.com:Trace001/notebook.git
Trace001
notebook
notebook
master

搜索帮助