终端中英字体匹配

一般终端只能设置一种字体,不会为了中英文字体各给出一个配置项。为了让中英文字体能够匹配设置,编辑文件~/.config/fontconfig/fonts.conf

这里假定配置如下:

  • 英文字体:DejaVu Sans Mono
  • 中文字体:Source Han Sans SC

将下面代码插入到文件中:

 <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>DejaVu Sans Mono</string>
    </test>
    <edit name="family" mode="prepend">
      <string>Source Han Sans SC</string>
    </edit>
  </match>

重新登录即可实现中英两种字体的匹配设置。

4 个赞

现在国内,对 Linux 字体配置有研究的,不多了。

国外也少。

你这里应该是 append 才对吧?不然思源黑体会优先。