Skip to content

Commit 646db48

Browse files
committed
update(font-settings): xml update
1 parent 25ea5fd commit 646db48

1 file changed

Lines changed: 89 additions & 11 deletions

File tree

content/posts/fonts-settings/index.md

Lines changed: 89 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ draft = false
44
title = '字形、字体以及我的配置'
55
tags = ['Linux', 'Arch Linux']
66
description = '花了点时间了解字体相关的知识~'
7+
lastmod = '2026-05-24 02:00:15+08:00'
78
+++
89

910
终于受不了终端里那丑得要死的宋体了,开干!XML?拿来把你!
@@ -81,10 +82,10 @@ FiraMonoNerdFontMono-Regular.otf: "FiraMono Nerd Font Mono" "Regular"
8182
我还额外安装了`otf-firamono-nerd`来实现 shell 的 emoji 图标,记住不!要!安!装!nerd-fonts 包集!那总共有`7GiB+`
8283

8384
我是强烈推荐去修改默认字体配置文件的,虽然 xml 的可读性确实不怎么样,但是根据别人的改嘛,查找替换也不算太难。这里就贴一下我的方案吧:
85+
8486
`~/.config/fontconfig/conf.d/99-notocjk.conf`
8587
```xml
86-
<!-- 在每个字体最后都配置了emoji,使得使用rime的时候候选框显示正确的emoji -->
87-
`<?xml version='1.0'?>
88+
<?xml version='1.0'?>
8889
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
8990
<fontconfig>
9091
<!-- 配置黑体-->
@@ -97,7 +98,6 @@ FiraMonoNerdFontMono-Regular.otf: "FiraMono Nerd Font Mono" "Regular"
9798
</test>
9899
<edit binding="strong" mode="prepend" name="family">
99100
<string>Noto Sans CJK SC</string>
100-
<string>Noto Color Emoji</string>
101101
</edit>
102102
</match>
103103
<!-- 配置宋体-->
@@ -110,7 +110,6 @@ FiraMonoNerdFontMono-Regular.otf: "FiraMono Nerd Font Mono" "Regular"
110110
</test>
111111
<edit binding="strong" mode="prepend" name="family">
112112
<string>Noto Serif CJK SC</string>
113-
<string>Noto Color Emoji</string>
114113
</edit>
115114
</match>
116115
<match target="pattern">
@@ -121,20 +120,98 @@ FiraMonoNerdFontMono-Regular.otf: "FiraMono Nerd Font Mono" "Regular"
121120
<!-- 这里等宽配置了两个字体,原因是FiraMono没有中文的等宽字体,下面写上Noto的等宽字体就可以自动fallback了-->
122121
<string>FiraMono Nerd Font Mono</string>
123122
<string>Noto Sans Mono CJK SC</string>
124-
<string>Noto Color Emoji</string>
125123
</edit>
126-
</match>
127-
<match target="font">
128-
<edit name="hinting" mode="assign">
124+
</match>
125+
<dir>~/.local/share/fonts</dir>
126+
</fontconfig>
127+
```
128+
129+
懒得在 kde 里面设置的话,可以直接把这个放到 conf.d:
130+
```xml
131+
<?xml version='1.0'?>
132+
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
133+
<fontconfig>
134+
<!--
135+
Artificial oblique for fonts without an italic or oblique version
136+
-->
137+
<match target="font">
138+
<!-- check to see if the font is roman -->
139+
<test name="slant">
140+
<const>roman</const>
141+
</test>
142+
<!-- check to see if the pattern requested non-roman -->
143+
<test compare="not_eq" name="slant" target="pattern">
144+
<const>roman</const>
145+
</test>
146+
<!-- multiply the matrix to slant the font -->
147+
<edit mode="assign" name="matrix">
148+
<times>
149+
<name>matrix</name>
150+
<matrix>
151+
<double>1</double>
152+
<double>0.2</double>
153+
<double>0</double>
154+
<double>1</double>
155+
</matrix>
156+
</times>
157+
</edit>
158+
<!-- pretend the font is oblique now -->
159+
<edit mode="assign" name="slant">
160+
<const>oblique</const>
161+
</edit>
162+
<!-- and disable embedded bitmaps for artificial oblique -->
163+
<edit mode="assign" name="embeddedbitmap">
164+
<bool>false</bool>
165+
</edit>
166+
</match>
167+
<!--
168+
Synthetic emboldening for fonts that do not have bold face available
169+
-->
170+
<match target="font">
171+
<!-- check to see if the weight in the font is less than medium which possibly need emboldening -->
172+
<test compare="less_eq" name="weight">
173+
<const>medium</const>
174+
</test>
175+
<!-- check to see if the pattern requests bold -->
176+
<test compare="more_eq" name="weight" target="pattern">
177+
<const>bold</const>
178+
</test>
179+
<!--
180+
set the embolden flag
181+
needed for applications using cairo, e.g. gucharmap, gedit, ...
182+
-->
183+
<edit mode="assign" name="embolden">
129184
<bool>true</bool>
130185
</edit>
186+
<!--
187+
set weight to bold
188+
needed for applications using Xft directly, e.g. Firefox, ...
189+
-->
190+
<edit mode="assign" name="weight">
191+
<const>bold</const>
192+
</edit>
131193
</match>
132194
<match target="font">
133-
<edit name="hintstyle" mode="assign">
134-
<const>hintfull</const>
195+
<edit mode="assign" name="rgba">
196+
<const>none</const>
197+
</edit>
198+
</match>
199+
<match target="font">
200+
<edit mode="assign" name="hinting">
201+
<bool>false</bool>
202+
</edit>
203+
</match>
204+
<match target="font">
205+
<edit mode="assign" name="hintstyle">
206+
<const>hintnone</const>
207+
</edit>
208+
</match>
209+
<dir>~/.fonts</dir>
210+
<match target="font">
211+
<edit mode="assign" name="antialias">
212+
<bool>true</bool>
135213
</edit>
136214
</match>
137-
<dir>~/.local/share/fonts</dir>
138215
</fontconfig>
139216
```
140217

@@ -145,6 +222,7 @@ FiraMonoNerdFontMono-Regular.otf: "FiraMono Nerd Font Mono" "Regular"
145222
Windows 中文版默认是使用微软雅黑的,修改需要改注册表。所以一般来说我们都会在软件里面单独修改,像 Firefox,Windows Terminal,VSCode 都支持。而其他的应用我选择用微软雅黑,因为 Windows 运行的旧应用很多都是硬编码微软雅黑的,调整他们会导致一些奇怪的问题,下面说说。
146223

147224
这是个版权字体(属于方正)正因为如此应该不少人吃了官司吧(?
225+
148226
## 点阵字体和矢量字体
149227

150228
点阵字体是以前低分辨率的时代使用的,现在已经基本淘汰了。但是你可能偶尔还能看到有人发那些锯齿感字体非常严重的图片,那大概就是用 xp 截图出来的。

0 commit comments

Comments
 (0)