趙健的技術筆記

CachyOS全域字體設定,解決部分程式字體太醜不統一

技術 約 2561 字 · 7 分鐘 - 次閱讀

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
分享:

評論