Files
dotfiles/memo/fontconfig.md
2025-11-14 02:54:05 +01:00

2.7 KiB

感觉不适合放到 stow 包里,毕竟这取决于系统上安装了哪些字体。那就放 memo 里好了。

path: ~/.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</family>
      <family>Noto Sans CJK SC</family>
      <family>Noto Sans CJK JP</family>
      <family>Noto Sans CJK KR</family>
      <family>Maple Mono NF CN</family>
    </prefer>
  </alias>

  <alias>
    <family>serif</family>
    <prefer>
      <family>Noto Serif</family>
      <family>Noto Serif CJK SC</family>
      <family>Noto Serif CJK JP</family>
      <family>Noto Serif CJK KR</family>
      <family>Maple Mono NF CN</family>
    </prefer>
  </alias>

  <alias>
    <family>monospace</family>
    <prefer>
      <family>Maple Mono NF CN</family>
      <family>Noto Sans Mono</family>
      <family>Noto Sans Mono CJK SC</family>
      <family>Noto Sans Mono CJK JP</family>
      <family>Noto Sans Mono CJK KR</family>
    </prefer>
  </alias>
</fontconfig>