XOrg Font Configuration 



  1. X.org Font Configuration and beautification

    • 1.1 xorg.conf modules

  2. X.org Font Path and /etc/fonts/

    • 2.1 xorg.conf font path

    • 2.2 /etc/fonts/ font directories

    • 2.3 Adding new fonts

    • 2.4 fc-list and xlsfont utilities

  3. Some Font Downloads

  4. Goodies

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

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

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

    • 4.4 Fonts in Gtk apps are too small when using KDE

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

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

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

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

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

    • 4.10 I wanna add more fonts.

    • 4.11 I want my font sizes to match my dpi settings

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

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

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

X.org Font Configuration and beautification 

xorg.conf modules 

As you can see, freetype provides everything provided by these other modules already. In addition, xtt will conflict with freetype.

X.org 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 X.org. 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.


How to add more fonts? 

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


Fonts in Gtk apps are too small when using KDE? 

Some apps compiled against Gtk+ 2.2 and under 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/gnome.sh, ~/.xinitrc, etc) will enable Xft for older apps

For similar problem as above with older Qt based apps, similar solution, add export QT_XFT=true somewhere.

How can I turn autohint 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">

No 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>

Enable anti-aliasing but only for bigger fonts that look too jagged? 

<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" >

How 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>

How to enable bitmap fonts? 

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.

How to get rid of all the 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.

The bytecode interpreter makes my fonts look crappy? 

No need to recompile. Freetype's internal auto-hinting is just shut off. 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">

Someone else has a different opinion … The bytecode interpreter is supposed to beat the autohinter by a long shot so i don't see why anyone would want the autohinter.

Linux: Fonts 

Getting fonts to look good on linux can be a frustrating experience. Below are notes on setting up X.org on Slackware, but everything is generic enough it should apply to other distros and to recent versions of Xfree86.


  1. Getting Fonts

  2. Installing Fonts

  3. Basic Configuration

  4. Background Information

  5. Starting X and setting dpi

  6. Core Font System & XFS font server

  7. Xft

  8. Freetype

  9. Fontconfig

  10. Slackware Packages

  11. Application-specific Notes

  12. Useful Commands

  13. Tutorial: MS Webfonts Step by Step

  14. Example files

  15. Font-Related Applications

  16. Misc Notes

  17. Related Links and Background Reading

Getting fonts 

The first step is to actually get some fonts. In addition to fonts distributed with Xfree86 and X.org, here are some other popular font resources:


Installing X core fonts 

Installing fonts is usually pretty straightforward:

  1. Copy the fonts to some directory; I usually use something in /usr/local/share. Ensure that they're world-readable (chmod 644).

  2. If the fonts don't come with fonts.scale and similar files, create those with the following commands, in order:

    # /usr/X11R6/bin/mkfontscale /path/to/your/fonts/
    # /usr/X11R6/bin/mkfontdir /path/to/your/fonts/
    # /usr/X11R6/bin/mkfontdir -e
    # /usr/X11R6/lib/X11/fonts/encodings

IDPI settings 

To find out what dpi settings are being used, do "xdpyinfo | grep resolution".

To specify the settings, edit the startx script.

First do "which startx" to find where the script is, then edit as root:

# defaultserverargs="-dpi 96"

To set 96 dpi for example. The default on Slackware is 75; some people feel 96 is preferable.

Xft Font System 

Xft is also part of the general Xfree86 and X.org offering. With Xft, applications have direct access to fonts and handle the rendering. This means that applications need to be written to support Xft. Xft handles Truetype fonts and anti-aliasing well.

Fontconfig - Xft relies on fontconfig to configure and set up fonts. There is a general fontconfig configuration file at /etc/fonts/fonts.conf; this file is system generated and should not be edited because changes may be overwritten by the system. To make system-wide changes, edit /etc/fonts/local.conf instead. Individual users can also create a ~.fonts.conf file in their home directory.

Note: Xft (Xft1) used /etc/X11/Xftconfig as main config file, and this file is still mentioned in lots of documentation, web postings, etc.; Xft2 uses /etc/fonts/fonts.conf and /etc/fonts/local.conf.

Editing /etc/fonts/local.conf or ~/fonts.conf:

To add a font directory so it's available to Xft, add the following:


Enabling or disabling antialiasing for all fonts (change false to true to enable):

<match target="font">
<edit name="antialias" mode="assign">

You can also turn antialiasing on and off for specific fonts:

<match target="font">
<test name="family">
<string>Font Name</string>
<edit name="antialias" mode="assign">

To choose a custom serif, sans serif, or monospace font, add the following:

<family>Bitstream Vera Sans</family>

Substitute serif or monospace for sans-serif to customize the fonts. The idea here is that most applications don't specify specific fonts; they just specify a serif font, or a monospaced font.


Main freetype site: http://freetype.sourceforge.net/index2.html

According to its site, Freetype2 is a "software font engine". It's available as part of the Xfree86/X.org X server.

Because of patent issues, many default installs of freetype2 have byte-hinting turned off; usually auto-hinting is enabled but, for many fonts, byte-hinting is supposed to do a better job. To get freetype enabled with byte-hinting, download freetype from the freetype site and manually edit the following file:


and uncomment the "define TT_CONFIG_OPTION_BYTECODE_INTERPRETER" line. The include file is well commented and is worth a read too. The package itself compiles with "configure —prefix=/usr && make, as root make install".


Main fontconfig site: http://freedesktop.org/software/fontconfig

According to the official site, fontconfig is "a library for configuring and customizing font access." The XFree86 documentation describes fontconfig in the following manner: "The Xft library has undergone a major restructuring, and is now split into fontconfig (which deals with font discovery and configuration and is independent from X), and Xft itself (which uses fontconfig and deals with font rasterisation and rendering)." I wasn't able to find similar documentation on X.org but I assume it's similar.

In other words, fontconfig is how fonts are set up and configured for use with Xft. Fontconfig comes as part of the main X package and doesn't need to be installed separately; I'm not sure there's an advantage to compiling a separate package.

Fontconfig should rebuild the list of fonts while it's running. If you need to force this, run: fc-cache

Gtk+2.2 uses Xft by default. To specify the default font used in gtk2 applications, create a file "~/.gtkrc-2.0" and add a line:

gtk-font-name = "Tahoma 8" or similar.

GTK+2.0 needs to have a variable set in order to use xft. Set the environment variable "GDK_USE_XFT" to "1" :

export GDK_USE_XFT=1

I assume this could also be done in a start up file (~./profile).

KDE. To enable Xft in KDE, click "Antialias fonts" in the font section of the KDE Control Center. This doesn't automatically antialias fonts; what is does is switch KDE to use Xft (you could modify /etc/fonts/local.conf to turn off antialiasing for example).

Mozilla. Mozilla needs to have xft support enabled when it's compiled. See my Mozilla page for how this can be done. http://www.jeffmccoy.info/linux/internet/mozilla.php

Useful Commands 


list all available fonts. You can also add a font-pattern to see only fonts which meet specific criteria:

$ fc-list :pattern

for example

$ fc-list :family
$ fc-list :lang=en # or any two letter language code

this also lists fonts, I think those served by the core font system, not Xft/fontconfig


displays information about the X server


sets various xserver preferences. Doing: xset q will query the server and return all sort of information on it (which font directories its looking in, where the error log is, etc).


displays the fonts installed on the system and also provides an easy way of selecting the string representing a font file (the long lines that say "-bitstream-charter-….-r….." etc. This utility is very useful when editing preference files for various applications.

Installing and Configuring Fonts 


Installing and Copying Fonts 

The installation of additional fonts in SUSE LINUX is very easy. Simply copy the fonts to any directory located in the X11 font path (see 11.2.2. "X11 Core Fonts"). To enable use of the fonts with the new xft font rendering system, the installation directory should be a subdirectory of the directories configured in /etc/fonts/fonts.conf (see 11.2.1. "Xft").

The font files can be copied manually (as root) to a suitable directory, such as /usr/X11R6/lib/X11/fonts/truetype. Alternatively, the task can be performed with the KDE font installer in the KDE Control Center. The result is the same.

Instead of copying the actual fonts, you can also create symbolic links. For example, you may want to do this if you have licensed fonts on a mounted Windows partition and want to use them. Subsequently, run SuSEconfig —module fonts.

SuSEconfig —module fonts executes the script /usr/sbin/fonts-config, which handles the configuration of the fonts. To see what this script does, refer to the manual page of the script (man fonts-config).

The procedure is the same for bitmap fonts, TrueType and OpenType fonts, and Type1 (PostScript) fonts. All these font types can be installed in any directory. Only CID-keyed fonts require a slightly different procedure. For this, see 11.2.3. "CID-Keyed Fonts".

X.Org contains two completely different font systems: the old X11 core font system and the newly designed Xft and fontconfig system. The following sections briefly describe these two systems.

11.2.1. Xft 

From the outset, the programmers of Xft made sure that scalable fonts including antialiasing are supported well. If Xft is used, the fonts are rendered by the application using the fonts, not by the X server as in the X11 core font system. In this way, the respective application has access to the actual font files and full control of how the glyphs are rendered. This constitutes the basis for the correct display of text in a number of languages. Direct access to the font files is very useful for embedding fonts for printing to make sure that the printout looks the same as the screen output.

In SUSE LINUX, the two desktop environments KDE and GNOME, Mozilla, and many other applications already use Xft by default. Xft is already used by more applications than the old X11 core font system.

Xft uses the fontconfig library for finding fonts and influencing how they are rendered. The properties of fontconfig are controlled by the global configuration file /etc/fonts/fonts.conf and the user-specific configuration file ~/.fonts.conf. Each of these fontconfig configuration files must begin with

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

and end with


To add directories to search for fonts, append lines such as the following:


However, this is usually not necessary. By default, the user-specific directory ~/.fonts is already entered in /etc/fonts/fonts.conf. Accordingly, all you need to do to install additional fonts is to copy them to ~/.fonts.

You can also insert rules that influence the appearance of the fonts. For example, enter

<match target="font">
 <edit name="antialias" mode="assign">

to disable antialiasing for all fonts or

<match target="font">
 <test name="family">
  <string>Luxi Mono</string>
  <string>Luxi Sans</string>
 <edit name="antialias" mode="assign">

to disable antialiasing for specific fonts.

By default, most applications use the font names sans-serif (or the equivalent sans), serif, or monospace. These are not real fonts but only aliases that are resolved to a suitable font, depending on the language setting.

Users can easily add rules to ~/.fonts.conf to resolve these aliases to their favorite fonts:


Because nearly all applications use these aliases by default, this affects almost the entire system. Thus, you can easily use your favorite fonts almost everywhere without having to modify the font settings in the individual applications.

Use the command fc-list to find out which fonts are installed and available for use. For instance, the command fc-list "" returns a list of all fonts. To find out which of the available scalable fonts (:outline=true) contain all glyphs required for Hebrew (:lang=he), their font names (family), their style (style), their weight (weight), and the name of the files containing the fonts, enter the following command:

fc-list ":lang=he:outline=true" family style weight file

The output of this command could appear as follows:

/usr/X11R6/lib/X11/fonts/truetype/FreeSansBold.ttf: FreeSans:style=Bold:weight=200
/usr/X11R6/lib/X11/fonts/truetype/FreeMonoBoldOblique.ttf: FreeMono:style=BoldOblique:weight=200
/usr/X11R6/lib/X11/fonts/truetype/FreeSerif.ttf: FreeSerif:style=Medium:weight=80
/usr/X11R6/lib/X11/fonts/truetype/FreeSerifBoldItalic.ttf: FreeSerif:style=BoldItalic:weight=200
/usr/X11R6/lib/X11/fonts/truetype/FreeSansOblique.ttf: FreeSans:style=Oblique:weight=80
/usr/X11R6/lib/X11/fonts/truetype/FreeSerifItalic.ttf: FreeSerif:style=Italic:weight=80
/usr/X11R6/lib/X11/fonts/truetype/FreeMonoOblique.ttf: FreeMono:style=Oblique:weight=80
/usr/X11R6/lib/X11/fonts/truetype/FreeMono.ttf: FreeMono:style=Medium:weight=80
/usr/X11R6/lib/X11/fonts/truetype/FreeSans.ttf: FreeSans:style=Medium:weight=80
/usr/X11R6/lib/X11/fonts/truetype/FreeSerifBold.ttf: FreeSerif:style=Bold:weight=200
/usr/X11R6/lib/X11/fonts/truetype/FreeSansBoldOblique.ttf: FreeSans:style=BoldOblique:weight=200
/usr/X11R6/lib/X11/fonts/truetype/FreeMonoBold.ttf: FreeMono:style=Bold:weight=200

Important parameters that can be queried with fc-list:

Table: Table 11.2. Parameters of fc-list
Parameter Meaning and Possible Values
family Name of the font family, for example, FreeSans.
foundry The manufacturer of the font, for example, urw.
style The font style, such as Medium, Regular, Bold, Italic, Heavy.
lang The language that the font supports, for example, de for German, ja for Japanese, zh-TW for traditional Chinese, or zh-CN for simplified Chinese.
weight The font weight, such as 80 for regular, 200 for bold.
slant The slant, usually 0 for none and 100 for italic.
file The name of the file containing the font.
outline true for outline fonts, false for other fonts.
scalable true for scalable fonts, false for other fonts.
bitmap true for bitmap fonts, false for other fonts.
pixelsize Font size in pixels. In connection with fc-list, this option only makes sense for bitmap fonts.

11.2.2. X11 Core Fonts 

Today, the X11 core font system supports not only bitmap fonts but also scalable fonts, like Type1 fonts, TrueType and OpenType fonts, and CID-keyed fonts. Unicode fonts have also been supported for quite some time. In 1987, the X11 core font system was originally developed for X11R1 for the purpose of processing monochrome bitmap fonts. All extensions mentioned above were added later.

Scalable fonts are only supported without antialiasing and subpixel rendering and the loading of large scalable fonts with glyphs for many languages may take a long time. The use of Unicode fonts may also be slow and requires more memory.

The X11 core font system has a few inherent weaknesses. It is outdated and can no longer be extended in a meaningful fashion. Although it must be retained for reasons of backward compatibility, the more modern Xft and fontconfig system should be used if at all possible.

For its operation, the X server needs to know what fonts it has available and where in the system it can find them. This is handled by a FontPath variable, which contains the path to all valid system font directories. In each of these directories, a file named fonts.dir lists the available fonts in this directory. The FontPath is generated by the X server at start-up. It searches for a valid fonts.dir file in each of the FontPath entries in the configuration file /etc/X11/XF86Config. These entries are found in the Files section. Display the actual FontPath with xset q. This path may also be changed at runtime with xset. To add an additional path, use xset +fp <path>. To remove an unwanted path, use xset -fp <path>.

If the X server is already active, newly installed fonts in mounted directories can be made available with the command xset fp rehash. This command is executed by SuSEconfig —module fonts. Because the command xset needs access to the running X server, this only works if SuSEconfig —module fonts is started from a shell that has access to the running X server. The easiest way to achieve this is to assume root permissions by entering sux and the root password. sux transfers the access permissions of the user who started the X server to the root shell. To check if the fonts were installed correctly and are available by way of the X11 core font system, use the command xlsfonts to list all available fonts.

By default, SUSE LINUX uses UTF-8 locales. Therefore, Unicode fonts should be preferred (font names ending with iso10646-1 in xlsfonts output). All available Unicode fonts can be listed with xlsfonts | grep iso10646-1. Nearly all Unicode fonts available in SUSE LINUX contain at least the glyphs needed for European languages (formerly encoded as iso-8859-*).

11.2.3. CID-Keyed Fonts 

In contrast to the other font types, you cannot simply install CID-keyed fonts in just any directory. CID-keyed fonts must be installed in /usr/share/ghostscript/Resource/CIDFont. This is not relevant for Xft and fontconfig, but it is necessary for Ghostscript and the X11 core font system.