Font configuration

From ArchWiki
Revision as of 18:03, 2 March 2006 by Gandalf (Talk | contribs) (Changed some paths to suit xorg 7 new paths)

Jump to: navigation, search

by PhrakTure Font Configuration and beautification

See the XOrg Font Documentation for full details.
See the FreeType2 Project Page for details on the freetype Module.

xorg.conf modules

  • freetype - support for True Type (ttf, ttc), Type1 (pfa, pfb), CID (cid), CFF, Open Type, bitmap (bdf, pcf, snf), Windows (fnt), PFR, and Type42 fonts
  • type1 - support for Type1 (pfa, pfb) and CID (cid) fonts
  • speedo - support for Bitstream Speedo (spd) fonts
  • xtt - support for True Type (ttf, ttc) fonts (conflicts with freetype)
  • bitmap - support for bitmap (bdf, pcf, snf) fonts

As you can see, freetype provides everything provided by these other modules already. In addition, xtt will conflict with freetype. Font Path and /etc/fonts/

xorg.conf font path

The font path described in the xorg.conf file is used for non-Xft fonts. It is worthwhile to specify a majority of fonts here. Applications which do not support Xft will fall back to the X Server's font path. Personally, I keep a minimum of fonts here - for use with xterm and it's ilk.

/etc/fonts/ font directories

The conf files in /etc/fonts (fonts.conf and local.conf) are used for fontconfig (Xft fonts). fonts.conf should never be changed, and all changes should be done in local.conf (for system wide changes) or ~/.fonts.conf (for user based changes). Files in /etc/fonts/conf.d are sourced when they start with a number and end with .conf.

The directories listed in fonts.conf are scanned by fc-cache for use with fontconfig (/usr/share/fonts and ~/.fonts). All fonts should be placed in these directories. If installing new fonts, running fc-cache -fv will detect the changes.

Adding new fonts

When new fonts are added, they are just files on your system. A handful of utilities need to be run in order to tell the system that new fonts have been added.


This will update the fontconfig cache, assuming the new fonts can be searched by fontconfig (see the above section about /etc/fonts)

ln -s /usr/X11R6/lib/X11/fonts/encodings/encodings.dir encodings.dir

These utilities need to be run from inside the directory of the new fonts. mkfontscale creates a fonts.scale file and mkfontdir creates a fonts.dir file. These files are used by the X Server, and only need to be done if the fonts are to be served through the FontPath of The encodings soft link allows the X Server to use these new fonts under all supported encodings. After all this, you should have 3 new files in the font dir : fonts.scale, fonts.dir, and encodings.dir.

fc-list and xlsfont utilities

These utilities will list, from the command line, all fonts available to each font subsystem. fc-list will list all fontconfig fonts, while xlsfont will list all X fonts. This is useful in combination with grep, i.e. "xlsfonts || grep -i bitstream" to see all bitstream fonts available.

Some Font Downloads

[1] [2] [3] [4]


My fonts look like crap - I've configured everything right but it appears I just have no good fonts.

I would suggest the following packages from pacman to fix this:

pacman -S ttf-ms-fonts ttf-cheapskate artwiz-fonts

I have some apps compiled against Gtk+ 2.2 and under and fonts still look like garbage.

Yeah, this happens. Modern GTK apps enable Xft by default, however, before 2.2 this was not the case. Maybe these apps should be updated to the newer GTK. If that is not an option, then adding the line export GDK_USE_XFT=1 to a global settings file (/etc/profile, /etc/profile.d/, ~/.xinitrc, etc) will enable Xft for older apps

I have a similar problem as above with older Qt based apps.

Similar solution, add export QT_XFT=true somewhere.

Fonts in Gtk apps are too small when using KDE

Install gtk-qt-engine:

  • # pacman -Sy gtk-qt-engine
  • Change the font size for Gtk apps in `Control Center' -> `Appearance & Themes' -> `GTK Styles and Fonts'.

The bytecode interpreter makes my fonts look crappy, and it's compiled in, do I need to recompile?

Nope, not at all. Freetype's internal auto-hinting is just shut off. In some distros, the bytecode interpreter is compiled in and enabled by default. As a result, the bytecode interpreter overrides the freetype autohinter (which the developers are very proud of). To force the autohinter to be on, add the following to /etc/fonts/local.conf or ~/.fonts.conf

     <match target="pattern">
        <edit name="autohint" mode="assign">

i don't understand this... The bytecode interpreter is supposed to beat the autohinter by a long shot so i don't see why anyone would want the autohinter.

Autohint works great but not for my bold fonts. How can I turn it off only for bold fonts?

Autohinter can give you nice fonts but often makes fonts too wide. This is especially annoying with bold fonts. Fortunatelly you can turn off autohinter for bold fonts while leaving it on for the rest.

  • First turn on autohinter (see above) and add the following to /etc/fonts/local.conf or ~/.fonts.conf
     <match target="font">
         <test name="weight" compare="more">
         <edit name="autohint" mode="assign">

I have a TFT/DFP/LCD display uses a DVI cable and fonts look odd and fuzzy

This is due to rendering differences between CRTs and non-CRTs. To fix this problem, you need to enable sub-pixel rendering. Edit the /etc/fonts/local.conf file and find the commented section with the "Enable subpixel rendering". Uncomment this section to enable this feature. NOTE that this will do nothing but a minor amount of extra work on CRTs and does not improve the display quality. Possible values for the const section include - rgb, bgr, vrgb, bgrv, and none.

     <match target="font">
        <test qual="all" name="rgba"><const>unknown</const></test>
           <edit name="rgba" mode="assign"><const>rgb</const></edit>

I don't want my fonts Antialiased under a certain point size.

A sample of this is in the /etc/fonts/local.conf file. It is commented, just like the subpixel rendering section. Changes, if anything, should be made to the compare="less_eq" portion, and the <int>12</int> portion - these are the comparison operation and point size to compare, respectively.

     <match target="pattern">
        <test qual="any" name="size" compare="less_eq">
        <edit name="antialias" mode="assign"><bool>false</bool></edit>

I'm using MS TrueType fonts (verdana) and want to enable anti-aliasing but only for bigger fonts that look too jagged.

     <?xml version="1.0"?>
     <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
     <match target="font" >
     <test compare"more" name"size" qual="any" >
     <edit mode"assign" name"antialias" >
     <match target="font" >
     <test compare"more" name"pixelsize" qual="any" >
     <edit mode"assign" name"antialias" >

I wanna add more fonts.

    Save your fonts in a directory and add it to /etc/fonts/local.conf

I want my font sizes to match my dpi settings

This goes into /etc/fonts/local.conf. This setting should match your dpi settings in either xorg.conf or your startx command. Use xdpyinfo to get your current dpi setting. Most people recommend/use a value of 96 or 100. Changing and setting the dpi of X is beyond the scope of this document (read: figure it out yourself... he he)

     <match target="pattern">
        <edit name="dpi" mode="assign"><double>100</double></edit>

I don't like font <enter name here> and want to use <another font name> instead

Easy! Again, it's an entry in /etc/fonts/local.conf. Technically this just adds the "preferred" font in front of the list of names to be used, so it's not 100% guarenteed in the case of a missing font.

        <family>Helvetica </family>
        <prefer><family>Bitstream Vera Sans Mono</family></prefer>

I have tons of disgusting pixel fonts that I don't want

The only two fonts that you absolutely have to have in order to start X are 'cursor' and 'fixed', both of which are in the fonts/misc directory. If you want to get rid of all the pixel fonts besides these two, you can delete all the files in the misc directory besides cursor.pcf.gz and all the fonts that are similar to either 9x18.pcf.gz or 9x18-ISO8859-1.pcf.gz. When I deleted all the fonts besides those from the misc directory, I had about 337 files still in it, so if you have a lot less than that you should probably put them back before restarting X.

Something or someone disabled all my non-scalable (bitmap) fonts, I want them back

By default, fontconfig 2.3.2-4 and higher will disable the use of bitmap fonts. This setting is managed in /etc/fonts/conf.d/10-no-bitmaps.conf, or in higher versions, /etc/fonts/conf.d/10-bitmaps.conf. To enable bitmap fonts and keep them enabled after upgrades of fontconfig, place a symlink from yes-bitmaps.conf to 10-bitmaps.conf, overwriting the symlink to no-bitmaps.conf.

WikiMigration--dlanor 14:05, 23 Jul 2005 (EDT)