Linux字体配置
Linux系统字体安装与配置指南,包括字体推荐、安装方法和fontconfig配置。
Linux字体配置
字体下载
这里推荐一些比较美观的字体
PingFang、SF
Windows字体包
下载windows字体包可以很好的解决在linux中缺少一些windows字体的问题
比如wps缺少字体
win10:
1
sudo git clone -b windows10 https://github.com/uinv/windows-fonts.git /usr/share/fonts/windows10-fonts
win11:
1
sudo git clone -b windows11 https://github.com/uinv/windows-fonts.git /usr/share/fonts/windows11-fonts
文泉驿
1
sudo apt install fonts-wqy-zenhei fonts-wqy-microhei
美观编程字体
https://github.com/marslo/fonts
字体安装
将字体包移入以下目录
系统级安装: /usr/share/fonts /usr/local/share/fonts
用户级安装: ~/.local/share/fonts
更新font-cache: sudo fc-cache -f -v
字体配置
创建文件:~/.config/fontconfig/conf.d/50-generic.conf
写入内容:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Micro Hei</string>
</edit>
</match>
<match target="pattern">
<test name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Micro Hei</string>
</edit>
</match>
<match target="pattern">
<test name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Dejavu Sans Mono</string>
<string>Fira Code</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>WenQuanYi Micro Hei</string>
</edit>
</match>
</fontconfig>
本文由作者按照 CC BY 4.0 进行授权