Difference between revisions of "Font configuration/Examples"

From ArchWiki
Jump to: navigation, search
(Moving example configurations to their own page (Font Configuration long enough as is, enables more people to add new ones))
 
(Pointed at fontconfig rules for Infinality rather than Ubuntu rendering)
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
[[Category:Fonts]]
 
Configurations can vary to a degree.  Please feel free to post your fontconfig configurations and the rationale behind them.
 
Configurations can vary to a degree.  Please feel free to post your fontconfig configurations and the rationale behind them.
  
== Web developer's ==
+
== brebs' configuration ==
  
A web developer's configuration (modified) taken from the forums. Back up current settings before testing the ones below:
+
This is a quest to get all fonts looking beautiful at all sizes, weights, etc., by tweaking the fontconfig rules for [http://www.infinality.net/blog/ Infinality rendering]. The latest version is [http://forums.gentoo.org/viewtopic-p-7273876.html#7273876 maintained here] -- brebs
 +
 
 +
== Basic config with no hinting for ''italic'' or '''bold''' and some other tuning==
  
 
<pre>
 
<pre>
<?xml version="1.0"?>
+
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
 
+
<!-- The cathectic LCD tweaks, from linuxquestions.org,
+
http://www.linuxquestions.org/questions/showthread.php?postid=1361098#post1361098 -->
+
 
+
 
<fontconfig>
 
<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" >
+
  <match target="font">
        <!-- Disable sub-pixel rendering.
+
    <test name="pixelsize" qual="any" compare="more"><double>15</double></test>
            X detects it anyway, and if you set this as well, it just looks really horrible -->
+
    <edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
        <edit mode="assign" name="rgba" >
+
    <edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
            <const>none</const>
+
  </match>
        </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">
+
  <match target="font">
        <!-- Disable auto hinting for bold fonts -->
+
    <test name="weight" compare="more"><const>medium</const></test>
        <test name="weight" compare="more">
+
    <edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
            <const>medium</const>
+
    <edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
        </test>
+
  </match>
        <edit name="autohint" mode="assign">
+
            <bool>false</bool>
+
        </edit>
+
    </match>
+
  
    <!-- Helvetica is a non true type font, and will look bad.
+
  <match target="font">
        This replaces it with whatever is the default sans-serif font -->
+
     <test name="slant" compare="not_eq"><double>0</double></test>
     <match target="pattern" name="family" >
+
    <edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
        <test name="family" qual="any" >
+
    <edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
            <string>Helvetica</string>
+
  </match>
        </test>
+
        <edit mode="assign" name="family" >
+
            <string>sans-serif</string>
+
        </edit>
+
    </match>
+
  
 
</fontconfig>
 
</fontconfig>
 
</pre>
 
</pre>
  
== breb's configuration ==
+
==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.
  
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:
+
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
 
+
<fontconfig>
<pre>
+
  <match target="font">
<?xml version="1.0"?>
+
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+
    <edit name="hinting" mode="assign"><bool>true</bool></edit>
<fontconfig>
+
    <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
 
+
    <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
    <!-- Info:
+
    <edit name="rgba" mode="assign"><const>rgb</const></edit>
        xeffects thread: http://forums.gentoo.org/viewtopic-t-511382.html
+
  </match>
        http://antigrain.com/research/font_rasterization/index.html
+
</fontconfig>
        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>
+

Revision as of 11:26, 19 April 2013

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

brebs' configuration

This is a quest to get all fonts looking beautiful at all sizes, weights, etc., by tweaking the fontconfig rules for Infinality rendering. 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>