Difference between revisions of "Font configuration/Examples"

From ArchWiki
Jump to: navigation, search
(added config)
(Replaced my out-of-date config with a link to the latest)
Line 57: Line 57:
 
</pre>
 
</pre>
  
== breb's configuration ==
+
== brebs' configuration ==
  
This configuration <small>[http://bbs.archlinux.org/viewtopic.php?id=78631]</small> depends on the '-lcd' packages and was made by ''brebs.'' It has been lightly edited:
+
This is a quest to get all fonts looking beautiful at all sizes, weights, etc., by tweaking the fontconfig rules. The latest version is [http://forums.gentoo.org/viewtopic-p-6183606.html#6183606 maintained here] -- brebs
 
+
<pre>
+
<?xml version="1.0"?>
+
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+
<fontconfig>
+
 
+
    <!-- Info:
+
        xeffects thread: http://forums.gentoo.org/viewtopic-t-511382.html
+
        http://antigrain.com/research/font_rasterization/index.html
+
        http://fontconfig.org/fontconfig-user.html -->
+
 
+
 
+
    <!-- http://bugs.gentoo.org/show_bug.cgi?id=130466 -->
+
    <alias>
+
        <family>serif</family>
+
        <prefer>
+
            <family>DejaVu Serif</family>
+
            <family>Bitstream Vera Serif</family>
+
        </prefer>
+
    </alias>
+
 
+
    <alias>
+
        <family>sans-serif</family>
+
        <prefer>
+
            <family>DejaVu Sans</family>
+
            <family>Bitstream Vera Sans</family>
+
            <family>Verdana</family>
+
            <family>Arial</family>
+
        </prefer>
+
    </alias>
+
 
+
    <alias>
+
        <family>monospace</family>
+
        <prefer>
+
            <family>DejaVu Sans Mono</family>
+
            <family>Bitstream Vera Sans Mono</family>
+
        </prefer>
+
    </alias>
+
 
+
    <!-- Reject bitmap fonts in favour of Truetype, Postscript, etc. -->
+
    <selectfont>
+
        <rejectfont>
+
            <pattern>
+
                <patelt name="scalable">
+
                    <bool>false</bool>
+
                </patelt>
+
            </pattern>
+
        </rejectfont>
+
    </selectfont>
+
 
+
    <!-- Replace Luxi Sans with a better-looking font - looks terrible at e.g. http://market-ticker.org/ -->
+
    <match name="family" target="pattern">
+
        <test name="family" qual="any">
+
            <string>Luxi Sans</string>
+
        </test>
+
        <edit name="family" mode="assign">
+
            <string>Liberation Sans</string>
+
        </edit>
+
    </match>
+
 
+
    <match target="pattern" name="family">
+
        <test qual="any" name="family"><string>fixed</string></test>
+
        <edit name="family" mode="assign"><string>monospace</string></edit>
+
    </match>
+
 
+
    <!-- Ubuntu options: lcdnone, lcddefault, lcdlight, lcdlegacy -->
+
    <!-- Blurry fonts: Try rgb, bgr, vrgb, vbgr for "rgba" -->
+
    <!-- Blurry: http://forums.gentoo.org/viewtopic-p-5060979.html#5060979 -->
+
    <match target="font">
+
        <edit name="rgba" mode="assign"><const>rgb</const></edit>
+
        <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
+
    <!-- To fix Calibri font - http://forums.fedoraforum.org/showthread.php?p=1045807#post1045807 -->
+
        <edit name="embeddedbitmap" mode="assign"><bool>false</bool></edit>
+
    </match>
+
 
+
    <!-- Tweak Courier -->
+
    <match name="family" target="pattern">
+
        <test name="family" qual="any">
+
            <string>Courier</string>
+
        </test>
+
        <edit name="lcdfilter" mode="assign"><const>lcdlegacy</const></edit>
+
    </match>
+
 
+
    <!-- Tweak Courier New -->
+
    <match name="family" target="pattern">
+
        <test name="family" qual="any">
+
            <string>Courier New</string>
+
        </test>
+
        <edit name="lcdfilter" mode="assign"><const>lcdlegacy</const></edit>
+
    </match>
+
 
+
    <!-- From http://forums.gentoo.org/viewtopic-t-511382-start-650.html
+
        To create difference between small Candara and small Candara bold -->
+
    <match name="family" target="pattern">
+
        <test name="family" qual="any">
+
            <string>Candara</string>
+
        </test>
+
        <test compare="less_eq" name="size">
+
            <double>10</double>
+
        </test>
+
        <test name="weight" compare="more">
+
            <const>medium</const>
+
        </test>
+
        <edit name="embolden" mode="assign">
+
            <bool>true</bool>
+
        </edit>
+
    </match>
+
 
+
    <!-- From http://bugs.gentoo.org/show_bug.cgi?id=233729 -->
+
    <match target="font">
+
        <test compare="eq" name="family">
+
            <string>Andale Mono</string>
+
        </test>
+
        <test compare="less" name="weight">
+
            <const>medium</const>
+
        </test>
+
        <test compare="less_eq" name="pixelsize">
+
            <double>7</double>
+
        </test>
+
        <edit mode="assign" name="antialias">
+
            <bool>false</bool>
+
        </edit>
+
    </match>
+
 
+
    <match target="font">
+
        <test compare="eq" name="family">
+
            <string>Arial</string>
+
        </test>
+
        <test compare="less" name="weight">
+
            <const>medium</const>
+
        </test>
+
        <test compare="less_eq" name="pixelsize">
+
            <double>7</double>
+
        </test>
+
        <edit mode="assign" name="antialias">
+
            <bool>false</bool>
+
        </edit>
+
    </match>
+
 
+
    <match target="font">
+
        <test compare="eq" name="family">
+
            <string>Comic Sans MS</string>
+
        </test>
+
        <test compare="less" name="weight">
+
            <const>medium</const>
+
        </test>
+
        <test compare="less_eq" name="pixelsize">
+
            <double>7</double>
+
        </test>
+
        <edit mode="assign" name="antialias">
+
            <bool>false</bool>
+
        </edit>
+
    </match>
+
 
+
    <match target="font">
+
        <test compare="eq" name="family">
+
            <string>Georgia</string>
+
        </test>
+
        <test compare="less" name="weight">
+
            <const>medium</const>
+
        </test>
+
        <test compare="less_eq" name="pixelsize">
+
            <double>7</double>
+
        </test>
+
        <edit mode="assign" name="antialias">
+
            <bool>false</bool>
+
        </edit>
+
    </match>
+
 
+
    <match target="font">
+
        <test compare="eq" name="family">
+
            <string>Times New Roman</string>
+
        </test>
+
        <!-- Looks better with lcdlegacy, e.g. http://www.billiardworld.com/glossary.html -->
+
        <edit name="lcdfilter" mode="assign"><const>lcdlegacy</const></edit>
+
    </match>
+
 
+
    <match target="font">
+
        <test compare="eq" name="family">
+
            <string>Trebuchet MS</string>
+
        </test>
+
        <test compare="less" name="weight">
+
            <const>medium</const>
+
        </test>
+
        <test compare="less_eq" name="pixelsize">
+
            <double>7</double>
+
        </test>
+
        <edit mode="assign" name="antialias">
+
            <bool>false</bool>
+
        </edit>
+
    </match>
+
 
+
    <match target="font">
+
        <test compare="eq" name="family">
+
            <string>Verdana</string>
+
        </test>
+
        <test compare="less" name="weight">
+
            <const>medium</const>
+
        </test>
+
        <test compare="less_eq" name="pixelsize">
+
            <double>7</double>
+
        </test>
+
        <edit mode="assign" name="antialias">
+
            <bool>false</bool>
+
        </edit>
+
    </match>
+
 
+
</fontconfig>
+
</pre>
+
  
 
== Basic config with no hinting for ''italic'' or '''bold''' and some other tuning==
 
== Basic config with no hinting for ''italic'' or '''bold''' and some other tuning==

Revision as of 06:37, 10 April 2010

Configurations can vary to a degree. Please feel free to post your fontconfig configurations and the rationale behind them.

Web developer's

A web developer's configuration (modified) taken from the forums. Back up current settings before testing the ones below:

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

<!-- The cathectic LCD tweaks, from linuxquestions.org,
 http://www.linuxquestions.org/questions/showthread.php?postid=1361098#post1361098 -->

<fontconfig>

    <match target="font" >
        <!-- Disable sub-pixel rendering.
             X detects it anyway, and if you set this as well, it just looks really horrible -->
        <edit mode="assign" name="rgba" >
            <const>none</const>
        </edit>
        
        <!-- Autohinter is not turned on automatically.
             Only disable this if you have recompiled Freetype with the bytecode interpreter,
             which is run automatically. -->
        <edit mode="assign" name="autohint">
            <bool>true</bool>
        </edit>
        <!-- Change hintstyle to full -->
        <edit mode="assign" name="hintstyle">
            <const>hintfull</const>
        </edit>
    </match>

    <match target="font">
        <!-- Disable auto hinting for bold fonts -->
        <test name="weight" compare="more">
            <const>medium</const>
        </test>
        <edit name="autohint" mode="assign">
            <bool>false</bool>
        </edit>
    </match>

    <!-- Helvetica is a non true type font, and will look bad.
         This replaces it with whatever is the default sans-serif font -->
    <match target="pattern" name="family" >
        <test name="family" qual="any" >
            <string>Helvetica</string>
        </test>
        <edit mode="assign" name="family" >
            <string>sans-serif</string>
        </edit>
    </match>

</fontconfig>

brebs' configuration

This is a quest to get all fonts looking beautiful at all sizes, weights, etc., by tweaking the fontconfig rules. The latest version is maintained here -- brebs

Basic config with no hinting for italic or bold and some other tuning

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font" >
<edit mode="assign" name="autohint">	<bool>true</bool></edit>
<edit mode="assign" name="hinting">	<bool>false</bool></edit>
<edit mode="assign" name="lcdfilter">	<const>lcddefault</const></edit>
<edit mode="assign" name="hintstyle">	<const>hintslight</const></edit>
<edit mode="assign" name="antialias">	<bool>true</bool></edit>
<edit mode="assign" name="rgba">	<const>rgb</const></edit>
</match>

<match target="font">
<test name="pixelsize" qual="any" compare="more"><double>15</double></test>
<edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
<edit mode="assign" name="hintstyle"><const>hintnone</const></edit></match>

<match target="font">
<test name="weight" compare="more"><const>medium</const></test>
<edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
<edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit></match>

<match target="font">
<test name="slant" compare="not_eq"><double>0</double></test>
<edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
<edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit></match>

</fontconfig>