<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
    <its:translateRule
      translate="no"
      selector="/fontconfig/*[not(self::description)]"
    />
  </its:rules>

  <description>Android Font Config</description>

  <!-- Font directory list -->

  <dir>/usr/share/fonts</dir>
  <dir>/usr/local/share/fonts</dir>
  <dir prefix="xdg">fonts</dir>
  <!-- the following element will be removed in the future -->
  <dir>~/.fonts</dir>

  <!-- 关闭内嵌点阵字体 -->
  <match target="font">
    <edit name="embeddedbitmap" mode="assign">
      <bool>false</bool>
    </edit>
  </match>
  <match target="font">
    <edit mode="assign" name="antialias">
      <bool>true</bool>
    </edit>
    <edit mode="assign" name="embeddedbitmap">
      <bool>false</bool>
    </edit>
    <edit mode="assign" name="hinting">
      <bool>true</bool>
    </edit>
    <edit mode="assign" name="hintstyle">
      <const>hintslight</const>
    </edit>
    <!-- <edit mode="assign" name="lcdfilter">
      <const>lcddefault</const>
    </edit>
    <edit mode="assign" name="rgba">
      <const>rgb</const>
    </edit> -->
  </match>
  <!-- 英文默认字体使用 Roboto 和 Noto Serif ,终端使用 DejaVu Sans Mono. -->
  <match>
    <test qual="any" name="family">
      <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Source Han Sans SC</string>
      <string>Noto Serif</string>
    </edit>
  </match>
  <match>
    <test qual="any" name="family">
      <string>Courier New</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>WenQuanYi Micro Hei Mono Light</string>
      <string>DejaVu Sans Mono</string>
      <string>Courier New</string>
    </edit>
  </match>
  <match>
    <test qual="any" name="family">
      <string>cursive</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>WenQuanYi Micro Hei Mono Light</string>
      <string>DejaVu Sans Mono</string>
      <string>cursive</string>
    </edit>
  </match>
  <match>
    <test qual="any" name="family">
      <string>Consolas</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>WenQuanYi Micro Hei Mono Light</string>
      <string>DejaVu Sans Mono</string>
      <string>Consolas</string>
    </edit>
  </match>
  <match>
    <test qual="any" name="family">
      <string>Segoe UI</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Source Han Sans SC</string>
      <string>Noto Sans CJK SC</string>
      <string>Segoe UI</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Source Han Sans SC</string>
      <string>Roboto</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>WenQuanYi Micro Hei Mono Light</string>
      <string>DejaVu Sans Mono</string>
    </edit>
  </match>

	<match target="font">
		<test name="family" compare="contains">
			<string>Emoji</string>
		</test>
		<edit name="hinting" mode="assign">
			<bool>true</bool>
		</edit>
		<edit name="hintstyle" mode="assign">
			<const>hintslight</const>
		</edit>
		<edit name="embeddedbitmap" mode="assign">
			<bool>true</bool>
		</edit>
	</match>

  <!-- 中文默认字体使用思源黑体和思源宋体,不使用　Noto Sans CJK SC 是因为这个字体会在特定情况下显示片假字. -->
  <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>serif</string>
    </test>
    <edit name="family" mode="prepend">
      <string>Source Han Sans SC</string>
    </edit>
  </match>
  <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend">
      <string>Source Han Sans SC</string>
    </edit>
  </match>
  <match>
    <test name="lang" compare="contains">
      <string>zh</string>
    </test>
    <test name="family">
      <string>monospace</string>
    </test>
    <edit name="family" mode="prepend">
      <string>WenQuanYi Micro Hei Mono Light</string>
      <string>Noto Sans Mono CJK SC</string>
    </edit>
  </match>

  <!-- Windows & Linux Chinese fonts. -->
  <!-- 把所有常见的中文字体映射到思源黑体和思源宋体，这样当这些字体未安装时会使用思源黑体和思源宋体.
解决特定程序指定使用某字体，并且在字体不存在情况下不会使用fallback字体导致中文显示不正常的情况. -->
  <match target="pattern">
    <test qual="any" name="family">
      <string></string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>Microsoft YaHei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>SimHei</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>

  <match target="pattern">
    <test qual="any" name="family">
      <string>宋体</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>新宋体</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>SimSun</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>NSimSun</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>宋体-18030</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>新宋体-18030</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>SimSun-18030</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>Arial</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>NSimSun-18030</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>AR PL ShanHeiSun Uni</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>AR PL New Sung</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>MingLiU</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>PMingLiU</string>
    </test>
    <edit name="family" mode="assign" binding="same">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>

  <!-- Load local system customization file -->
  <include ignore_missing="yes">conf.d</include>

  <!-- Font cache directory list -->

  <cachedir>/var/cache/fontconfig</cachedir>
  <cachedir prefix="xdg">fontconfig</cachedir>
  <!-- the following element will be removed in the future -->
  <cachedir>~/.fontconfig</cachedir>

  <config>
    <!-- Rescan configuration every 30 seconds when FcFontSetList is called -->
    <rescan>
      <int>30</int>
    </rescan>
  </config>
</fontconfig>