Skip to content

Instantly share code, notes, and snippets.

@dantmnf
Last active November 13, 2024 07:56
Show Gist options
  • Save dantmnf/6779436 to your computer and use it in GitHub Desktop.
Save dantmnf/6779436 to your computer and use it in GitHub Desktop.
fontconfig configuration file
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font">
<edit mode="assign" name="hinting"><bool>false</bool></edit>
<edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
<edit mode="assign" name="rgba"><const>rgb</const></edit>
<edit mode="assign" name="antialias"><bool>true</bool></edit>
<edit mode="assign" name="lcdfilter"><const>lcddefault</const></edit>
</match>
<match target="scan">
<or>
<test name="family"><string>Heiti SC</string></test>
<test name="family"><string>Heiti TC</string></test>
</or>
<test name="style"><string>Light</string></test>
<edit name="weight"><const>regular</const></edit>
</match>
<match target="scan">
<or>
<test name="family"><string>Heiti SC</string></test>
<test name="family"><string>Heiti TC</string></test>
</or>
<test name="style"><string>Medium</string></test>
<edit name="weight"><const>bold</const></edit>
</match>
<match target="scan">
<or>
<test name="family"><string>Heiti SC</string></test>
<test name="family"><string>Heiti TC</string></test>
</or>
<test name="style"><string>Thin</string></test>
<edit name="weight"><const>thin</const></edit>
<edit name="style" mode="assign_replace"><string>Thin</string></edit>
</match>
<match target="scan">
<test name="style"><string>Black</string></test>
<edit name="weight"><const>black</const></edit>
</match>
<match target="scan">
<test name="style"><string>Bold</string></test>
<edit name="weight"><const>bold</const></edit>
</match>
<match target="scan">
<test name="style"><string>Light</string></test>
<edit name="weight"><const>light</const></edit>
</match>
<alias binding="strong">
<family>HanaMinA</family>
<accept><family>HanaMinB</family></accept>
</alias>
<alias binding="strong">
<family>Terminus</family>
<accept><family>Unibit</family></accept>
</alias>
<alias binding="strong">
<family>Terminess Powerline</family>
<accept><family>Unibit</family></accept>
</alias>
<!--
此处定义的 sans-serif-* 只供 Firefox 和其他可以识别语言并调用相对应字体的程序使用
serif-* 和 monospace-* 同理
.dantCJK-* 随后将被替换为具体的字形
-->
<alias binding="strong">
<family>sans-serif</family>
<prefer>
<family>Segoe UI</family>
<family>Source Sans Pro</family>
<family>DejaVu Sans</family>
<family>.dantCJK-Hei-CHS</family>
<family>.dantCJK-Hei-CHT</family>
<family>.dantCJK-Gothic-J</family>
<family>.dantCJK-Gothic-K</family>
<family>HanaMinA</family>
</prefer>
</alias>
<alias binding="strong">
<family>sans-serif-cht</family>
<prefer>
<family>Segoe UI</family>
<family>.dantCJK-Hei-CHT</family>
<family>.dantCJK-Hei-CHS</family>
<family>.dantCJK-Gothic-J</family>
<family>.dantCJK-Gothic-K</family>
<family>HanaMinA</family>
</prefer>
</alias>
<alias binding="strong">
<family>sans-serif-j</family>
<prefer>
<family>Segoe UI</family>
<family>.dantCJK-Gothic-J</family>
<family>.dantCJK-Gothic-K</family>
<family>.dantCJK-Hei-CHT</family>
<family>.dantCJK-Hei-CHS</family>
</prefer>
</alias>
<alias binding="strong">
<family>sans-serif-k</family>
<prefer>
<family>Segoe UI</family>
<family>.dantCJK-Gothic-K</family>
<family>.dantCJK-Gothic-J</family>
<family>.dantCJK-Hei-CHT</family>
<family>.dantCJK-Hei-CHS</family>
</prefer>
</alias>
<alias binding="same">
<family>serif</family>
<prefer>
<family>Times New Roman</family>
<family>.dantCJK-Song-CHS</family>
<family>.dantCJK-Song-CHT</family>
<family>.dantCJK-Mincho</family>
<family>.dantCJK-Myeongjo</family>
</prefer>
</alias>
<alias binding="same">
<family>serif-cht</family>
<prefer>
<family>Times New Roman</family>
<family>.dantCJK-Song-CHT</family>
<family>.dantCJK-Song-CHS</family>
<family>.dantCJK-Mincho</family>
<family>.dantCJK-Myeongjo</family>
</prefer>
</alias>
<alias binding="same">
<family>serif-j</family>
<prefer>
<family>Times New Roman</family>
<family>.dantCJK-Mincho</family>
<family>.dantCJK-Myungjo</family>
<family>.dantCJK-Song-CHT</family>
<family>.dantCJK-Song-CHS</family>
</prefer>
</alias>
<alias binding="same">
<family>serif-k</family>
<prefer>
<family>Times New Roman</family>
<family>.dantCJK-Myeongjo</family>
<family>.dantCJK-Mincho</family>
<family>.dantCJK-Song-CHT</family>
<family>.dantCJK-Song-CHS</family>
</prefer>
</alias>
<alias binding="strong">
<family>monospace</family>
<prefer>
<family>Consolas</family>
<family>.dantCJK-Hei-CHS</family>
<family>.dantCJK-Hei-CHT</family>
<family>.dantCJK-Gothic-J</family>
<family>.dantCJK-Gothic-K</family>
</prefer>
</alias>
<alias binding="strong">
<family>monospace-cht</family>
<prefer>
<family>Consolas</family>
<family>.dantCJK-Hei-CHT</family>
<family>.dantCJK-Hei-CHS</family>
<family>.dantCJK-Gothic-J</family>
<family>.dantCJK-Gothic-K</family>
</prefer>
</alias>
<alias binding="strong">
<family>monospace-j</family>
<prefer>
<family>Consolas</family>
<family>.dantCJK-Gothic-J</family>
<family>.dantCJK-Gothic-K</family>
<family>.dantCJK-Hei-CHT</family>
<family>.dantCJK-Hei-CHS</family>
</prefer>
</alias>
<alias binding="strong">
<family>monospace-k</family>
<prefer>
<family>Consolas</family>
<family>.dantCJK-Gothic-K</family>
<family>.dantCJK-Gothic-J</family>
<family>.dantCJK-Hei-CHT</family>
<family>.dantCJK-Hei-CHS</family>
</prefer>
</alias>
<!--
下面是详细设置,比如使用那个厂商的字体之类的。
请使用真实存在于系统中的字体
ps. 本列表中的大部分 CJK 字体取自 OS X,XXX SC/XXX TC 之类的字体不能用于 Windows 上,
即使是用于 fontconfig + freetype,也需要进行一定的设置
-->
<alias binding="strong">
<family>.dantCJK-Song-CHS</family>
<prefer>
<family>Songti SC</family>
<family>SimSun</family>
</prefer>
</alias>
<alias binding="strong">
<family>.dantCJK-Song-CHT</family>
<prefer>
<family>Songti TC</family>
<family>PMingLiU</family>
</prefer>
</alias>
<alias binding="strong">
<family>.dantCJK-Kai-CHS</family>
<prefer>
<family>Kaiti SC</family>
<family>SimKai</family>
</prefer>
</alias>
<alias binding="strong">
<family>.dantCJK-Kai-CHT</family>
<prefer>
<family>Kaiti TC</family>
<family>DFKai-SB</family>
</prefer>
</alias>
<alias binding="strong">
<family>.dantCJK-Hei-CHS</family>
<prefer>
<!--family>Source Han Sans SC</family-->
<family>Heiti SC</family>
<family>SimHei</family>
</prefer>
</alias>
<alias binding="strong">
<family>.dantCJK-Hei-CHT</family>
<prefer>
<!--family>Source Han Sans TC</family-->
<family>Heiti TC</family>
<family>Microsoft JhengHei</family>
</prefer>
</alias>
<alias binding="strong">
<family>.dantCJK-Mincho</family>
<prefer>
<family>Hiragino Mincho Pro</family>
<family>HanaMinA</family>
</prefer>
</alias>
<alias binding="strong">
<family>.dantCJK-Myeongjo</family>
<prefer>
<family>Nanum Myeongjo</family>
</prefer>
</alias>
<alias binding="strong">
<family>.dantCJK-Gothic-J</family>
<prefer>
<family>Hiragino Kaku Gothic Pro</family>
</prefer>
</alias>
<alias binding="strong">
<family>.dantCJK-Gothic-K</family>
<prefer>
<family>Nanum Gothic</family>
</prefer>
</alias>
</fontconfig>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment