---
title: "CachyOS全局字体设置，解决部分程序字体太丑不统一"
date: 2025-12-15T12:01:01.000Z
tags: ["CachyOS", "arch", "linux", "字体", "全局字体", "linux字体", "linux全局字体", "cachyos字体", "cachyos全局字体"]
categories: ["技术"]
canonical: https://www.zhaojian.net/cachyos-global-font-settings-fixing-fonts/
author: 赵健
---

CachyOS 已经连续12个月 在 DistroWatch 排名第一了，之前就听说过这个系统很快，但只安装过，没有深度体验。因为刚刚装完系统的字体太丑，直接就放弃了。最近有空又装了一次，速度是真快，日常操作能真实感受出来。但设置过字体后，还是会出现部分程序字体不统一，太丑了。通过下面方法尝试修改用户字体配置文件后，终于统一了。

修改 fontconfig 配置，编辑用户字体配置文件

```
nano ~/.config/fontconfig/fonts.conf
```

使用下面内容替换原有配置文件内容

```
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
<fontconfig>
  <!-- Artificial oblique for fonts without an italic or oblique version -->
  <match target="font">
    <!-- check to see if the font is roman -->
    <test name="slant">
      <const>roman</const>
    </test>
    <!-- check to see if the pattern requested non-roman -->
    <test compare="not_eq" name="slant" target="pattern">
      <const>roman</const>
    </test>
    <!-- multiply the matrix to slant the font -->
    <edit mode="assign" name="matrix">
      <times>
        <name>matrix</name>
        <matrix>
          <double>1</double>
          <double>0.2</double>
          <double>0</double>
          <double>1</double>
        </matrix>
      </times>
    </edit>
    <!-- pretend the font is oblique now -->
    <edit mode="assign" name="slant">
      <const>oblique</const>
    </edit>
    <!-- and disable embedded bitmaps for artificial oblique -->
    <edit mode="assign" name="embeddedbitmap">
      <bool>false</bool>
    </edit>
  </match>

  <!-- Synthetic emboldening for fonts that do not have bold face available -->
  <match target="font">
    <!-- check to see if the weight in the font is less than medium which possibly need emboldening -->
    <test compare="less_eq" name="weight">
      <const>medium</const>
    </test>
    <!-- check to see if the pattern requests bold -->
    <test compare="more_eq" name="weight" target="pattern">
      <const>bold</const>
    </test>
    <!-- set the embolden flag needed for applications using cairo, e.g. gucharmap, gedit, ... -->
    <edit mode="assign" name="embolden">
      <bool>true</bool>
    </edit>
    <!-- set weight to bold needed for applications using Xft directly, e.g. Firefox, ... -->
    <edit mode="assign" name="weight">
      <const>bold</const>
    </edit>
  </match>

  <!-- 添加这部分：字体家族优先级设置 -->
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Noto Sans CJK SC</family>
    </prefer>
  </alias>

  <alias>
    <family>serif</family>
    <prefer>
      <family>Noto Serif CJK SC</family>
    </prefer>
  </alias>

  <alias>
    <family>monospace</family>
    <prefer>
      <family>Noto Sans Mono CJK SC</family>
    </prefer>
  </alias>
</fontconfig>
```

刷新字体缓存

```
fc-cache -fv
```