<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

  <!-- Prevent synthetic functions on bitmap / non-aa fonts.
       This is done below by fooling fontconfig into thinking they are already
       bold / italic. -->
  <match target="font">
    <test name="slant">
      <const>roman</const>
    </test>
    <test target="pattern" name="slant" compare="not_eq">
      <const>roman</const>
    </test>
    <test name="scalable">
      <bool>false</bool>
    </test>
    <edit name="slant" mode="assign">
      <const>oblique</const>
    </edit>
  </match>

  <match target="font">
    <test name="slant">
      <const>roman</const>
    </test>
    <test target="pattern" name="slant" compare="not_eq">
      <const>roman</const>
    </test>
    <test name="antialias">
      <bool>false</bool>
    </test>
    <edit name="slant" mode="assign">
      <const>oblique</const>
    </edit>
  </match>

  <match target="font">
    <test name="weight" compare="less_eq">
      <const>medium</const>
    </test>
    <test target="pattern" name="weight" compare="more">
      <const>medium</const>
    </test>
    <test name="scalable">
      <bool>false</bool>
    </test>
    <edit name="weight" mode="assign">
      <const>bold</const>
    </edit>
  </match>

  <match target="font">
    <test name="weight" compare="less_eq">
      <const>medium</const>
    </test>
    <test target="pattern" name="weight" compare="more">
      <const>medium</const>
    </test>
    <test name="antialias">
      <bool>false</bool>
    </test>
    <edit name="weight" mode="assign">
      <const>bold</const>
    </edit>
  </match>

  <!-- Prevent bold-ish fonts from being emboldened -->
  <match target="font">
    <test name="weight" compare="more_eq">
      <const>semibold</const>
    </test>
    <test target="pattern" name="weight">
      <const>bold</const>
    </test>
    <edit name="weight" mode="assign">
      <const>bold</const>
    </edit>
  </match>

  <!-- Prevent thin-ish fonts from being emboldened -->
  <match target="font">
    <test name="weight" compare="less">
      <const>book</const>
    </test>
    <test target="pattern" name="weight">
      <const>bold</const>
    </test>
    <edit name="weight" mode="assign">
      <const>bold</const>
    </edit>
  </match>

  <!-- Prevent certain font families from being embolden -->
  <match target="font">
    <test name="family">
      <string>Archivo Black</string>
    </test>
    <edit name="embolden" mode="assign">
      <bool>false</bool>
    </edit>
    <edit name="weight" mode="assign">
      <const>black</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>Arial Black</string>
    </test>
    <edit name="embolden" mode="assign">
      <bool>false</bool>
    </edit>
    <edit name="weight" mode="assign">
      <const>black</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>Clear Sans Light</string>
    </test>
    <edit name="embolden" mode="assign">
      <bool>false</bool>
    </edit>
    <edit name="weight" mode="assign">
      <const>light</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>Clear Sans Thin</string>
    </test>
    <edit name="embolden" mode="assign">
      <bool>false</bool>
    </edit>
    <edit name="weight" mode="assign">
      <const>thin</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>Franklin Gothic Demi Cond</string>
    </test>
    <edit name="embolden" mode="assign">
      <bool>false</bool>
    </edit>
    <edit name="weight" mode="assign">
      <const>black</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>Franklin Gothic Heavy</string>
    </test>
    <edit name="embolden" mode="assign">
      <bool>false</bool>
    </edit>
    <edit name="weight" mode="assign">
      <const>black</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>League Gothic</string>
    </test>
    <edit name="embolden" mode="assign">
      <bool>false</bool>
    </edit>
    <edit name="weight" mode="assign">
      <const>medium</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>Sansation Light</string>
    </test>
    <edit name="embolden" mode="assign">
      <bool>false</bool>
    </edit>
    <edit name="weight" mode="assign">
      <const>light</const>
    </edit>
  </match>

  <!-- Prevent certain font families from being artificially slanted -->
  <match target="font">
    <test name="family">
      <string>WenQuanYi Zen Hei</string>
    </test>
    <test target="pattern" name="slant" compare="not_eq">
      <const>roman</const>
    </test>
    <edit name="matrix" mode="assign">
      <times>
        <name>matrix</name>
        <matrix>
          <double>1</double>
          <double>-0.2</double>
          <double>0</double>
          <double>1</double>
        </matrix>
      </times>
    </edit>
    <edit name="slant" mode="assign">
      <const>roman</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>WenQuanYi Zen Hei Mono</string>
    </test>
    <test target="pattern" name="slant" compare="not_eq">
      <const>roman</const>
    </test>
    <edit name="matrix" mode="assign">
      <times>
        <name>matrix</name>
        <matrix>
          <double>1</double>
          <double>-0.2</double>
          <double>0</double>
          <double>1</double>
        </matrix>
      </times>
    </edit>
    <edit name="slant" mode="assign">
      <const>roman</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>WenQuanYi Zen Hei Sharp</string>
    </test>
    <test target="pattern" name="slant" compare="not_eq">
      <const>roman</const>
    </test>
    <edit name="matrix" mode="assign">
      <times>
        <name>matrix</name>
        <matrix>
          <double>1</double>
          <double>-0.2</double>
          <double>0</double>
          <double>1</double>
        </matrix>
      </times>
    </edit>
    <edit name="slant" mode="assign">
      <const>roman</const>
    </edit>
    <edit name="embeddedbitmap" mode="assign">
      <bool>false</bool>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>WenQuanYi Micro Hei</string>
    </test>
    <test target="pattern" name="slant" compare="not_eq">
      <const>roman</const>
    </test>
    <edit name="matrix" mode="assign">
      <times>
        <name>matrix</name>
        <matrix>
          <double>1</double>
          <double>-0.2</double>
          <double>0</double>
          <double>1</double>
        </matrix>
      </times>
    </edit>
    <edit name="slant" mode="assign">
      <const>roman</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>WenQuanYi Micro Hei Mono</string>
    </test>
    <test target="pattern" name="slant" compare="not_eq">
      <const>roman</const>
    </test>
    <edit name="matrix" mode="assign">
      <times>
        <name>matrix</name>
        <matrix>
          <double>1</double>
          <double>-0.2</double>
          <double>0</double>
          <double>1</double>
        </matrix>
      </times>
    </edit>
    <edit name="slant" mode="assign">
      <const>roman</const>
    </edit>
  </match>

  <match target="font">
    <test name="family">
      <string>Inconsolata for Powerline</string>
    </test>
    <test target="pattern" name="slant" compare="not_eq">
      <const>roman</const>
    </test>
    <edit name="matrix" mode="assign">
      <times>
        <name>matrix</name>
        <matrix>
          <double>1</double>
          <double>-0.2</double>
          <double>0</double>
          <double>1</double>
        </matrix>
      </times>
    </edit>
    <edit name="slant" mode="assign">
      <const>roman</const>
    </edit>
  </match>

</fontconfig>
