Skip to content

Instantly share code, notes, and snippets.

@sodabiscuit
Created March 4, 2013 07:13
Show Gist options
  • Save sodabiscuit/5080579 to your computer and use it in GitHub Desktop.
Save sodabiscuit/5080579 to your computer and use it in GitHub Desktop.
linux font render
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Info:
Latest version: http://forums.gentoo.org/viewtopic-p-6183606.html#6183606
xeffects thread: http://forums.gentoo.org/viewtopic-t-511382.html
Sub-pixel hinting: http://www.infinality.net/blog/?p=67
Alternative: https://wiki.ubuntu.com/Fonts
http://wiki.archlinux.org/index.php/XOrg_Font_Configuration
http://antigrain.com/research/font_rasterization/index.html
http://freddie.witherden.org/pages/font-rasterisation/
http://fontconfig.org/fontconfig-user.html
Free fonts: http://www.design-by-izo.com/2010/06/07/8-excellent-fonts-for-screen-and-print/
-->
<!-- Crimson Text: http://www.fontsquirrel.com/fonts/download/Crimson_text -->
<alias>
<family>Times</family>
<prefer>
<family>Times New Roman</family>
<family>Times New Roman PS</family>
<family>Times Ten</family>
<family>Crimson Text</family>
<family>Cambria</family>
</prefer>
</alias>
<!-- http://bugs.gentoo.org/show_bug.cgi?id=130466
Times: http://en.wikipedia.org/wiki/Times_Roman
Crimson Text: http://www.fontsquirrel.com/fonts/download/Crimson_text
Linux Libertine from http://sourceforge.net/projects/linuxlibertine/
Is important to have good, easily-readable default fonts for:
serif, sans-serif, monospace, Courier -->
<alias>
<family>serif</family>
<prefer>
<family>Times New Roman</family>
<family>Crimson Text</family>
<family>Cambria</family>
<family>DejaVu Serif</family>
<family>Bitstream Vera Serif</family>
<family>Liberation Serif</family>
<family>Linux Libertine</family>
</prefer>
</alias>
<!-- Corbel is ugly - don't use -->
<alias>
<family>sans-serif</family>
<prefer>
<family>DejaVu Sans</family>
<family>Bitstream Vera Sans</family>
<family>Verdana</family>
<family>Liberation Sans</family>
</prefer>
</alias>
<!-- Examples: http://www.codestyle.org/css/font-family/sampler-Monospace.shtml
Used to show text email messages in Evolution, by default.
DejaVu Sans Mono is still the best. -->
<alias>
<family>monospace</family>
<prefer>
<family>DejaVu Sans Mono</family>
<family>Nimbus Mono L</family>
<family>Lucida Sans Typewriter</family>
<family>Consolas</family>
<family>Bitstream Vera Sans Mono</family>
<family>Liberation Mono</family>
<family>Andale Mono</family>
</prefer>
</alias>
<!-- Common web font -->
<match target="pattern">
<test name="family">
<string>Helvetica</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Helvetica World</string>
</edit>
</match>
<!-- Common web font -->
<match target="pattern">
<test name="family">
<string>Courier</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Courier New</string>
</edit>
</match>
<!-- Replace Arial bold with a better-looking font - looks terrible at e.g. http://digg.com
Calibri is quite good.
ChaletBookTT: http://www.identifont.com/
Also try "Arial Unicode MS" or "Arial MT": http://en.wikipedia.org/wiki/Arial_Unicode
Aeriel from http://aur.archlinux.org/packages.php?ID=21892
i.e. ftp://ftp.fi.debian.org/pub/gentoo/distfiles/ttf-arkpandora-2.04.tgz
Liberation Sans: https://fedorahosted.org/releases/l/i/liberation-fonts/
PT Sans: http://www.paratype.com/public/ and http://www.fontstock.com/public/PTSans.zip
CartoGothic Std: http://www.fontsquirrel.com/fonts/download/CartoGothic-Std
Cantarell: http://www.fontsquirrel.com/fonts/download/Cantarell
Comfortaa: http://www.fontsquirrel.com/fonts/download/Comfortaa -->
<match target="pattern">
<test name="family">
<string>Arial</string>
</test>
<test compare="less" name="pixelsize">
<double>12</double>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Liberation Sans</string>
</edit>
</match>
<!-- From:
http://repos.archlinux.org/wsvn/packages/fontconfig/trunk/
http://bugs.archlinux.org/task/15833
http://bugs.freedesktop.org/show_bug.cgi?id=18002
http://freedesktop.org/wiki/Software/poppler
http://bugs.gentoo.org/show_bug.cgi?id=303591
Get urw-fonts from http://koji.fedoraproject.org/koji/packageinfo?packageID=905 -->
<match target="pattern">
<test name="family">
<string>ZapfDingbats</string>
</test>
<edit name="family" mode="prepend" binding="same">
<string>Dingbats</string>
</edit>
</match>
<!-- Based on http://bugs.gentoo.org/show_bug.cgi?id=282151 -->
<match target="pattern">
<test name="family">
<string>NewCenturySchlbk</string>
</test>
<edit name="family" mode="append" binding="same">
<string>Century Schoolbook L</string>
</edit>
</match>
<match target="pattern">
<test name="family">
<string>AvantGarde</string>
</test>
<edit name="family" mode="append" binding="same">
<string>URW Gothic L</string>
</edit>
</match>
<match target="pattern">
<test name="family">
<string>ZapfChancery</string>
</test>
<edit name="family" mode="append" binding="same">
<string>URW Chancery L</string>
</edit>
</match>
<!-- From suse-pre-user.conf in fontconfig-2.8.0-20.1.src.rpm from http://software.opensuse.org/search?baseproject=openSUSE%3AFactory&p=1&q=fontconfig
http://bugs.gentoo.org/show_bug.cgi?id=303591
https://bugs.freedesktop.org/show_bug.cgi?id=27653 -->
<match target="pattern">
<test name="family">
<string>symbol</string>
</test>
<edit name="family" mode="append" binding="strong">
<string>OpenSymbol</string>
</edit>
<edit name="family" mode="append" binding="strong">
<string>Standard Symbols L</string>
</edit>
</match>
<match target="pattern" name="family">
<test name="family" qual="any">
<string>fixed</string>
</test>
<edit name="family" mode="assign">
<string>monospace</string>
</edit>
</match>
<!--
From suse-pre-user.conf in fontconfig-2.8.0-2.7.src.rpm from http://download.opensuse.org/factory/repo/src-oss/suse/src/
OpenSUSE Bugzilla #52167 and bugzilla #246804:
Some fonts like "Luxi Mono", and "Nimbus Mono L"
which are intended to be monospace are not detected as
monospace because they have a few glyphs with wrong width.
That is of course a bug in the fonts but this is difficult
to fix and sometimes even impossible because of license reasons.
For most purposes it is useful to force these fonts to be
detected as monospace because it doesn't matter much if only
a handful of rarely used glyphs has the wrong width.
-->
<match target="scan" >
<test compare="contains" name="family">
<string>Luxi Mono</string>
<string>Nimbus Mono L</string>
</test>
<edit mode="assign_replace" name="spacing">
<const>mono</const>
</edit>
</match>
<!-- From http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/fontconfig/current/SOURCES/20-mdv-CJK-dualwidth.conf?view=markup
and http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/fontconfig/current/SOURCES/25-mdv-CJK-disable-hinting.conf?view=log
https://bugs.freedesktop.org/show_bug.cgi?id=17267
We can't hint CJK fonts well, so turn off hinting for CJK fonts.
Some Asian fonts misadvertise themselves as monospaced when
in fact they are dual-spaced (half and full). This makes
FreeType very confused as it forces all widths to match.
Undo this magic by disabling the width-forcing code.
-->
<match target="font">
<test target="pattern" name="lang" compare="contains">
<string>zh-tw</string>
<string>zh-cn</string>
<string>ja</string>
<string>ko</string>
</test>
<edit name="spacing">
<const>proportional</const>
</edit>
<edit name="globaladvance">
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>false</bool>
</edit>
</match>
<!-- Reject bitmap fonts in favour of Truetype, Postscript, etc. -->
<selectfont>
<rejectfont>
<pattern>
<patelt name="scalable">
<bool>false</bool>
</patelt>
</pattern>
</rejectfont>
</selectfont>
<!-- http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/fontconfig/current/SOURCES/26-mdv-no-embeddedbitmap.conf?view=markup
Japanese fonts: http://bbs.archlinux.org/viewtopic.php?id=91276
Calibri font: http://forums.fedoraforum.org/showthread.php?p=1045807#post1045807
Don't use bitmaps at all, because they look horrible. Enable them for individiual fonts and sizes, if needed. -->
<match target="font">
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
</match>
<!-- This is only here in case it is useful sometime.
Example at http://www.codestyle.org/css/font-family/sampler-Monospace.shtml
Others from 25-no-bitmap-fedora.conf at:
http://distro.ibiblio.org/pub/linux/distributions/texstar/pclinuxos/apt/pclinuxos/2010/SRPMS.main/fontconfig-2.8.0-1pclos2010.src.rpm
<match target="font">
<test name="family" qual="any">
<string>Cambria</string>
<string>Monaco</string>
<string>Kochi Mincho</string>
<string>Kochi Gothic</string>
<string>Sazanami Mincho</string>
<string>Sazanami Gothic</string>
</test>
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
</match> -->
<!-- Ubuntu options: lcdnone, lcddefault, lcdlight, lcdlegacy -->
<!-- hintnone, hintslight, hintmedium, hintfull -->
<!-- autohint off: https://bugs.launchpad.net/ubuntu/+source/fontconfig/+bug/14310/comments/14 -->
<!-- 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="autohint" mode="assign"><bool>false</bool></edit>
<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>
</match>
<!-- autohint.
Luxi Sans - http://market-ticker.denninger.net/
Some entries copied from http://www.infinality.net/blog/?p=10
Arial Black: http://www.wired.com/ -->
<match target="font">
<test name="family" qual="any">
<string>Arial Narrow</string>
<string>Bitstream Vera Serif</string>
<string>Courier10 BT</string>
<string>DejaVu LGC Sans Mono</string>
<string>DejaVu Sans Mono</string>
<string>DejaVu Serif</string>
<string>Delicious</string>
<string>District</string>
<string>Dutch801 Rm BT</string>
<string>Fontin Sans</string>
<string>FreeMono</string>
<string>FreeSans</string>
<string>FreeSerif</string>
<string>Gotham Book</string>
<string>Gotham Light</string>
<string>Gotham Medium</string>
<string>Helvetica</string>
<string>Helvetica LT Std</string>
<string>Lacuna</string>
<string>Lucida Console</string>
<string>Lucida Grande</string>
<string>Lucida Sans Unicode</string>
<string>Luxi Sans</string>
<string>Luxi Serif</string>
<string>MankSans</string>
<string>Metabook-Roman</string>
<string>MetaMedium-Roman</string>
<string>Miriam</string>
<string>Miso</string>
<string>MS Mincho</string>
<string>Myriad Pro</string>
<string>Myriad Web Pro</string>
<string>New Century Schoolbook</string>
<string>Nimbus Mono L</string>
<string>Nina</string>
<string>Ocean Sans Std</string>
<string>Swansea</string>
<string>Swiss721</string>
<string>Utopia</string>
<string>Vegur</string>
<string>Verdimka</string>
</test>
<edit name="autohint" mode="assign">
<bool>true</bool>
</edit>
</match>
</fontconfig>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment