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

<!-- ************************************************************ -->
<!-- Hinting and antialiasing                                     -->
<!-- ************************************************************ -->


<!--
    Using hinting=true, hintstyle=hintfull and antialias=true
    is a good default for most fonts.

    Match on "pattern" for the default, not on "font" to make
    it easier to override the default using FcPatternDel()
    and FcPatternAdd...() (see bugzilla #104365).
-->

        <match target="pattern">
                <edit name="hinting">
                        <bool>true</bool>
                </edit>
                <edit name="antialias">
                        <bool>true</bool>
                </edit>
        </match>

<!--
    Set autohinter=true as the default, then add exceptions for certain fonts.

    Match on "font" here, not on "pattern" because of bug #118131 comment #93.
    (If an autohint value is set in pattern, OpenOffice 2.1 will use that even
    if there are fontconfig rules matching on "font" which should override it
    again). This doesn't cause any problems for Cairo/Gnome (see bug #104365)
    because Cairo/Gnome don't try to change the autohint value anyway. 
-->
	
        <match target="font">
                <edit name="autohint">
                        <bool>true</bool>
                </edit>
        </match>

<!--
    TrueType Fonts which have high quality byte code interpreter
    instructions can look very good in even in small sizes when using
    the byte code interpreter (autohint=false). This is true
    both with and without anti-aliasing. 
    In black and white (antialias=false) the results when rendering
    with the byte code interpreter may even look as good as high quality
    bitmap fonts.

    On the other hand, some low quality TrueType Fonts do not have
    byte code interpreter instructions at all or only very bad byte
    code and may look better when the autohinter is used.
    (See "FreeSans" for example, it looks better with the
    autohinter which is especially obvious if anti-aliasing is off).
-->

	<!--
	    Switch off the autohinter for TrueType fonts in order
            to use the byte code interpreter.
	-->
		
	<match target="font">
		<test name="fontformat">
			<string>TrueType</string>
		</test>
                <edit name="autohint">
                        <bool>false</bool>
                </edit>
	</match>

	<!--
	    Switch on the autohinter for a few TrueType fonts which
            have no byte code or very bad byte code and look better
            with the autohinter:

            But see also bug #215602 for many fonts the autohinter
            seriously distorts the metrics so badly that
            even the digits which should be monospaced are not
            monospaced at all anymore.

            For example, for DejaVu Sans: when autohinter used, 
            there is unnatural big space between 'a' and 'z', 
            'd' and 'o' or 'o' and 'g' in string "lazy dog" 
            for smaller sizes. That doesn't show with BCI. 
            Similarly for Droid Sans, see rendering of 'g' glyph
            in smaller sizes, or rendering of "dog" word in 
            smaller sizes.

            Because of this problem, better don't switch on
            the autohinter for

               Sazanami
               IPA
               DejaVu Sans Light
               DejaVu Sans Condensed
               DejaVu Serif Condensed
               FreeSans
               FreeSerif
               FreeMono

            and other fonts with similar problems until this is solved
            in the autohinter.
	-->

	<match target="font">
		<test name="family"><string>MS Gothic</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>MS PGothic</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>MS UI Gothic</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>MS Mincho</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>MS PMincho</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPSoeiKakupoptai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSGothicE</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSGothicM</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGKyokashotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSSoeiKakugothicUB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPGothicB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPGothicE</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPGothicM</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSKyokashotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGMaruGothicMPRO</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPSoeiKakugothicUB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGMinchoL</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPMinchoL</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGMinchoB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPMinchoB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSMinchoB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGMinchoE</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPMinchoE</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSMinchoE</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSoeiKakugothicUB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGGyoshotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPGyoshotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSGyoshotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSoeiKakupoptai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSSoeiPresenceEB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPSoeiPresenceEB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGGothicB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGGothicE</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGGothicM</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSoeiPresenceEB</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGPKyokashotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSSoeiKakupoptai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>HGSeikaishotaiPRO</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLKyokashotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLMincho</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLPMincho</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLPGothic</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLPKyokashotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLMarugothicM</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLGyoshotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLPGyoshotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLSGyoshotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLPMarugothicM</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLSMarugothicM</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLSKyokashotai</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>TLGothic</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnBatangBold</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnBatang</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnBom</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnDinaruBold</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnDinaruLight</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnDinaru</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnDotumBold</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnDotum</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnGraphicBold</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnGraphic</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnGungseo</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnJamoBatang</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnJamoDotum</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnJamoNovel</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnJamoSora</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnPenheulim</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnPen</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnPilgia</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnPilgiBold</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnPilgi</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnShinmun</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnTaza</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnVada</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>UnYetgul</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>
	<match target="font">
		<test name="family"><string>Anonymous Pro</string></test>
		<edit name="autohint"><bool>true</bool></edit>
	</match>

        <!--
            The following rule sets up black and white rendering with
            the byte code interpreter for a small list of fonts which
            are known to have good byte code and give bitmap quality
            results at small sizes.
            The pixelsize limit is set to '0' though, which effectively
            disables this rule by default because most users don't like
            that bitmap look and feel.
            If you like a bitmap look and feel of your desktop,
            copy this rule into your ~/.fonts.conf file and replace the '0'
            with non-zero pixelsize limit. Using '18' as the pixelsize
            limit is a good choice if you have the fonts in this list installed
            and like a bitmap look and feel. 
        <match target="font">
                <test name="family">
                        <string>Andale Mono</string>
                        <string>Arial</string>
                        <string>Comic Sans MS</string>
                        <string>Georgia</string>
                        <string>Impact</string>
                        <string>Trebuchet MS</string>
                        <string>Verdana</string>
                        <string>Courier New</string>
                        <string>Times New Roman</string>
                        <string>Tahoma</string>
                        <string>Webdings</string>
                        <string>Albany AMT</string>
                        <string>Thorndale AMT</string>
                        <string>Cumberland AMT</string>
                        <string>Andale Sans</string>
                        <string>Andy MT</string>
                        <string>Bell MT</string>
                        <string>Monotype Sorts</string>
                        <string>Lucida Sans Typewriter</string>
                        <string>Lucida Sans</string>
                        <string>Lucida Bright</string>
                </test>
		<test name="pixelsize" compare="less_eq">
				<double>0</double>
		</test>
                <edit name="autohint">
                        <bool>false</bool>
                </edit>
                <edit name="antialias">
                        <bool>false</bool>
                </edit>
        </match>
        -->


<!--
  Some CJK fonts require the byte code interpreter to be rendered correctly.

  These are composite fonts which store components and composing information
  and compose the glyphs on the fly using the hinting instructions.

  For all such fonts we switch off the autohinter here.
  When "autohint" is set to "false", the byte code interpreter will
  be used if it has been enabled at all when compiling freetype2.

  The Chinese fonts "MingLiu" and "PMingLiU" used to belong to the fonts
  which absolutely require the byte code interpreter to be rendered
  correctly. 
  But apparently the new versions of "MingLiU" and "PMingLiU" from Windows
  Vista are rendered correctly without the byte code interpreter.

-->

        <match target="font">
                <test name="family"><string>MingLiU</string></test>
                <edit name="autohint"><bool>false</bool></edit>
        </match>
        <match target="font">
                <test name="family"><string>PMingLiU</string></test>
                <edit name="autohint"><bool>false</bool></edit>
        </match>
                        

<!-- 
Hinting for CJK fonts in freetype doesn't yet work as well as for Latin fonts.

Recently the autohinter in in freetype has been improved for CJK fonts
a lot but it is still not perfect. Therefore one might want to switch
off the autohinter for CJK fonts. 

This can be achieved by using the following rules:

        <match target="font">
                <test name="lang" compare="contains"><string>ja</string></test>
                <edit name="autohint"><bool>false</bool></edit>
        </match>
        <match target="font">
                <test name="lang" compare="contains"><string>zh</string></test>
                <edit name="autohint"><bool>false</bool></edit>
        </match>
        <match target="font">
                <test name="lang" compare="contains"><string>ko</string></test>
                <edit name="autohint"><bool>false</bool></edit>
        </match>
-->

<!--
for some Bengali fonts (e.g. "Mukti Narrow"), the autohinter works well
with the patch from http://www.kde.gr.jp/~akito/patch/freetype2/2.1.7
applied. But for "Likhan" it still doesn't work that well
(look how the "matra" lines at the top line up). Therefore, switch
off the autohinter for the "Likhan" font:
-->

        <match target="font">
                <test name="family">
                        <string>Likhan</string>
                </test>
                <edit name="autohint">
                        <bool>false</bool>
                </edit>
        </match>

</fontconfig>
