Difference between revisions of "Font configuration/Examples"

From ArchWiki
Jump to: navigation, search
(Replaced my out-of-date config with a link to the latest)
Line 93: Line 93:
 
</fontconfig>
 
</fontconfig>
 
</pre>
 
</pre>
 +
 +
==Sharp fonts==
 +
It took me a while to find font settings that are sharp and not overly blurred. This font config does exactly that and seems to work fine everywhere. I searched for this because "Chromium" wasn't looking good with no aliasing at all. The below config fixes that as well.
 +
 +
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
 +
<fontconfig>
 +
  <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>hintfull</const></edit>
 +
    <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
 +
    <edit name="rgba" mode="assign"><const>rgb</const></edit>
 +
  </match>
 +
</fontconfig>

Revision as of 16:18, 1 October 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>

Sharp fonts

It took me a while to find font settings that are sharp and not overly blurred. This font config does exactly that and seems to work fine everywhere. I searched for this because "Chromium" wasn't looking good with no aliasing at all. The below config fixes that as well.

<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <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>hintfull</const></edit>
    <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
    <edit name="rgba" mode="assign"><const>rgb</const></edit>
  </match>
</fontconfig>