Font configuration/Examples

From ArchWiki
Revision as of 06:37, 10 April 2010 by Brebs (Talk | contribs) (Replaced my out-of-date config with a link to the latest)

Jump to: navigation, search

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>