<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <!-- Default font (no fc-match pattern) -->
  <match>
    <edit mode="prepend" name="family">
      <string>{{ sans_font }}</string>
    </edit>
  </match>

  <!-- Default font for the ja_JP locale (no fc-match pattern) -->
  <!--
  <match>
    <test compare="contains" name="lang">
      <string>ja</string>
    </test>
    <edit mode="prepend" name="family">
      <string>Sarasa Fixed J</string>
    </edit>
  </match>
  -->

  <!-- Default sans-serif font -->
  <match target="pattern">
    <test qual="any" name="family"><string>sans-serif</string></test>
    <edit name="family" mode="prepend" binding="same"><string>{{ sans_font }}</string></edit>
    <edit name="family" mode="append" binding="same"><string>{{ cjk_sans_font }}</string></edit>
  </match>

  <!-- Default serif fonts -->
  <match target="pattern">
    <test qual="any" name="family"><string>serif</string></test>
    <edit name="family" mode="prepend" binding="same"><string>{{ serif_font }}</string></edit>
    <edit name="family" mode="append" binding="same"><string>{{ cjk_serif_font }}</string></edit>
  </match>

  <!-- Default monospace fonts -->
  <match target="pattern">
    <test qual="any" name="family"><string>monospace</string></test>
    <edit name="family" mode="prepend" binding="same"><string>{{ monospace_font }}</string></edit>
    <edit name="family" mode="append" binding="same"><string>{{ cjk_monospace_font }}</string></edit>
  </match>

  <!-- Fallback fonts preference order -->
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>{{ sans_font }}</family>
      <family>Noto Sans</family>
      <family>FreeSans</family>
      <family>Open Sans</family>
      <family>Droid Sans</family>
      <family>Ubuntu</family>
      <family>Roboto</family>
      <family>{{ cjk_sans_font }}</family>
      <family>NotoSansCJK</family>
      <family>Source Han Sans JP</family>
      <family>IPAPGothic</family>
      <family>VL PGothic</family>
      <family>Koruri</family>
    </prefer>
  </alias>
  <alias>
    <family>serif</family>
    <prefer>
      <family>{{ serif_font }}</family>
      <family>Noto Serif</family>
      <family>FreeSerif</family>
      <family>Droid Serif</family>
      <family>Roboto Slab</family>
      <family>{{ cjk_serif_font }}</family>
      <family>IPAPMincho</family>
    </prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>{{ monospace_font }}</family>
      <family>Noto Sans Mono</family>
      <family>FreeMono</family>
      <family>Inconsolatazi4</family>
      <family>Ubuntu Mono</family>
      <family>Droid Sans Mono</family>
      <family>Roboto Mono</family>
      <family>{{ cjk_monospace_font }}</family>
      <family>IPAGothic</family>
    </prefer>
  </alias>
  <!-- <match target="font"> -->
  <!--   <edit name="antialias" mode="assign"> -->
  <!--     <bool>true</bool> -->
  <!--   </edit> -->
  <!--   <edit name="hinting" mode="assign"> -->
  <!--     <bool>true</bool> -->
  <!--   </edit> -->
  <!--   <edit name="hintstyle" mode="assign"> -->
  <!--     <const>hintnone</const> -->
  <!--   </edit> -->
  <!--   <edit name="rgba" mode="assign"> -->
  <!--     <const>none</const> -->
  <!--   </edit> -->
  <!--   <edit name="autohint" mode="assign"> -->
  <!--     <bool>false</bool> -->
  <!--   </edit> -->
  <!--   <edit name="lcdfilter" mode="assign"> -->
  <!--     <const>lcdnone</const> -->
  <!--   </edit> -->
  <!--   <edit name="dpi" mode="assign"> -->
  <!--     <double>96</double> -->
  <!--   </edit> -->
  <!-- </match> -->
</fontconfig>
