fonts.conf 如何设置让中英文分别用不同的字体显示?

如题,想用 Ubuntu 显示英文,用 noto sans cjk sc 显示中文。我从 archwiki 上看了看,照葫芦画瓢,折腾了一下,但是并没有实现。以下是~/.config/fontconfig/fonts.conf的配置。不知道要怎么设置…

<fontconfig>
  
  
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Ubuntu</family>
      <family>Noto Sans CJK SC</family>
      <family>Noto Color Emoji</family>
    </prefer>
  </alias>
  
  
  <alias>
    <family>serif</family>
    <prefer>
      <family>Ubuntu</family>
      <family>Noto Serif CJK SC</family>
      <family>Noto Color Emoji</family>
    </prefer>
  </alias>

  <alias>
    <family>monospace</family>
    <prefer>
      <family>JetBrains Mono</family>
      <family>Noto Sans Mono CJK SC</family>
      <family>Noto Color Emoji</family>
    </prefer>
  </alias>

  <match target="pattern">
    <test qual="any" name="family">
      <string>Helvetica</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>sans-serif</string>
    </edit>
  </match>

  <match target="pattern">
    <test qual="any" name="family">
      <string>Consolas</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>monospace</string>
    </edit>
  </match>

  <match target="pattern">
    <test qual="any" name="family">
      <string>Courier</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>monospace</string>
    </edit>
  </match>

 <match target="font">
  
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>

  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>

  <edit mode="assign" name="hintstyle">
   <const>hintfull</const>
  </edit>

  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>

  <edit mode="assign" name="lcdfilter">
    <const>lcddefault</const>
  </edit>
 
 </match>
</fontconfig>

fc-match -s “sans-serif” | head -n 10

结果是什么?

oS 的 noto 字体拆包有点奇怪,我发现 Noto Sans SC 这个字体名中间没有 CJK,但 Noto Serif 又有,可以先用 fc-list 看一下可选项