NOTE: This page is largely obsolete; the defoma part of it has been superseded by the discussion at, which contains a more authoritative and thorough discussion of defoma.

Furthermore, there is a effort to replace defoma with fontconfig; see As of May, 2012, defoma has been removed from Debian's unstable distribution: see bug 651494.

On the other hand, the transition to fontconfig has made me expand that part of the discussion; see below. See also file:///usr/share/doc/doc-linux-html/HOWTO/Font-HOWTO/index.html

Finally, a Debian Wiki page,, has much useful information (and further links) to help you with fonts on Debian.


Managing fonts is a major headache for the system administrator, because there are so many different kinds of fonts and font-file formats, on the one hand; and so many different applications that need particular font formats, on the other. Thus there is a two-dimensional problem of matching up different kinds of fonts with different application programs.

While TeX and LaTeX have their own font-management system, it would be nice to (a) make their fonts available to other parts of the system, such as X-window programs, and GhostScript; and (b) make fonts installed for such applications also be available to the TeX system. In general, you'd like a font, once it's installed, to be available to everything.

In general, this isn't possible: X and TeX naturally use bitmapped fonts, while gs and PostScript printers use outline fonts. However, in many cases there are similar fonts available in these different categories; so it should be possible to use an outline font in place of a similar-looking bitmapped font, and vice versa. But how can we match them up? (This task is generally referred to as font substitution).

There is a partial answer to this problem in the fontconfig library, which tries to make fonts interoperable within the X-window system. But only X applications that have been set up to use this library can take advantage of it. Debian's defoma is an attempt to make fonts widely available, even outside X, without having to re-program applications.

Unfortunately, defoma is very de-centralized: its files are scattered all over the filesystem. That wouldn't be a problem if there were good documentation; but the current (2005) man page is both too short, and written in way reminiscent of Systran “translations” from Japanese — much like the instruction manuals that used to come with consumer electronics from the Mysterious East. Furthermore, the manpage (and other documentation) focuses on details, never providing an overview of the defoma system.

This page attempts to provide such an overview, with pointers to the detailed documentation — much of which is buried in comments in the perl scripts that make up the executable parts of defoma.

Overview of defoma


The heart of the defoma system is a database that describes fonts, and cross-indexes font files with applications. The database files are maintained by a complex system of Perl5 scripts, directed by configuration files in /etc/defoma. The object of the game is to make sure that the directories where each application naturally looks for fonts are fully populated with font-files of the correct sort.


To do this, we need a setup script for each application (or group of similar applications) that converts the various different kinds of fonts to what this kind of application requires. This means that each application must be provided with a defoma font-configuration script; but this is less trouble than modifying its source code to use fontconfig. The writer of the script only needs to know what fonts are useful, not how the application itself works.

Furthermore, defoma provides a set of Perl modules to do most of the work. These modules understand the defoma database files, and can extract information about fonts from them, as well as modifying the necessary files to keep track of what has been configured. So the application-specific Perl script can be fairly short.

Font substitution

An important part of the system is to match up font-files in different formats that provide similar font glyphs. For example, the X window system needs bitmapped fonts in particular sizes, while GhostScript needs outline fonts that are scalable. So it's important to cross-index equivalent fonts of the two kinds, so that (say) something that looks like Times-Roman is available to both X and gs and the printing system — even though X requires bitmapped fonts and gs and PostScript printers need outline fonts.

But Adobe's “Times-Roman” corresponds to URW's type-1 font called “Nimbus Roman No9”, and to X's bitmapped fonts like “-cronyx-times-medium-r-normal--14-100-100-100-p-54-koi8-r”. Because font names differ from one system to another, the system needs information about about font glyphs, such as presence or absence of serifs; slant; weight; fixed-width vs. proportionally-spaced; etc. This information is used to substitute one font for another, if an exact equivalent is not available. This descriptive information about fonts is stored in defoma's configuration files.

In principle, if the correct information is supplied for each font package, and the correct defoma-configuration script is supplied with each font-using application package, defoma should be able to keep things properly configured as packages are added to or removed from the system.


In practice, there are difficulties — particularly in supplying the correct configuration information. While defoma provides a couple of scripts to extract information about fonts from PostScript Printer Definition (*.ppd) files and font-files themselves, these automated setup scripts are not very clever, and provide only a crude approximation to what is needed: they must be edited by hand to obtain useful results.

Also, the defoma documentation doesn't explain how to make it work properly with other systems, such as fontconfig, X, and its font servers. A particular sequence of operations is necessary to get all the pieces working together smoothly.

General layout

Let's first see where all the pieces are hidden:

Database files: /var/lib/defoma

The database files are stored in /var/lib/defoma and its subdirectories. There is a subdirectory for each defoma-aware application:  fontconfig.d  for the files that support  fontconfig,  gs.d  for files supporting gs, etc.

There are several kinds of database files:

id-cache  files
These are the main database files, located in the application subdirectories. Each line contains a font pathname and information about the font. (These are manipulated by the Defoma::Id module; see  man Defoma::Id  for details.)
font-cache  files
These summarize the properties of fonts in a standard way, one font per line. There is a separate font-cache file for each type of font. They are in the main /var/lib/defoma directory. (Manipulated by the Defoma::Font module.)
subst-cache  files
These hold  font-file – font-name  pairs that are candidates for substitutions. The substitution rules are stored in subst-rule files in subdirectories here, too. (Both are manipulated by the Defoma::Subst module.)
status-cache  file
This file, at /var/lib/defoma/status-cache, stores the times at which the various font databases were last changed, and the time defoma-reconfigure was last run.

Perl scripts and modules

The Perl5 scripts that configure defoma for use with the various applications are in /var/lib/defoma/scripts; every defoma-aware Debian package should install one of them. They use modules that are in /usr/share/perl5/Debian/Defoma, and other Perl scripts in /usr/share/defoma.

The modules Defoma::Id, Defoma::Font, and Defoma::Subst each have a man page. In addition, there is a man page for Defoma::Common, the basic set of Perl modules used by the whole defoma system. The operation of the Defoma::Id module is more fully explained in Chapters 4 and 5 of the tutorial for writing new ones, at file:///usr/share/doc/defoma-doc/defoma-script.html/index.html. Chapter 6 deals with the use of Defoma::Subst.

However, a great deal of useful information about the working of these scripts is buried in comments and messages to users inside the scripts themselves. If you read Perl — or even if you don't — looking at the scripts is informative.

Configuration files

As you would expect, the configuration files for defoma are in /etc/defoma. Several kinds of information are provided:

character-set encoding data
These are the files with the string cset in their names. All pretty standard stuff that should cause no problems.
the  config  directory
little Perl modules to handle special problems of particular font types.
the  *.subst-rule  files
These tell defoma how particular applications handle font-name substitutions. On my system,  fontconfig.subst-rule  has only very general rules for the generic classes “serif”, “sans-serif”, and “monospace”; and  ghostscript.subst-rule  (which once contained only comments) has been eliminated.
the  hints
The files here describe the principal features of the fonts defoma must manage. This is by far the most troublesome part of the system.

Font descriptions: the “hintfiles”

What defoma calls “hintfiles” have nothing to do with what's usually meant by hinting in typography. Instead, they're a simple database of font properties and characteristics.

A handy item in hintfiles is the X-FontName, the X Logical Font Descriptor (XLFD) that is used by X-Window applications. Defoma doesn't actually use this, but it's available for use by X applications.

While there's a command called  defoma-hints  that makes a feeble effort to set up a hintfile by inspecting a font file, the simplistic assumptions it makes guarantee that the results will be incomplete and, more likely than not, wrong. You must manually inspect the resulting hintfile before using it, and correct the errors.

Bear in mind that different “hints” (i.e., font properties) are required for different font categories. For example, TrueType fonts use a property called Location in the hintfiles, which is actually a language-region pair. This is important for various Oriental languages (like Chinese and Japanese) that use different character sets in different countries. These fonts have generally been produced in the TrueType format; no other font category worries about the Location property.

The main problem with  defoma-hints  is that it tries to infer the characteristics of a font — in particular, the weight and style — from the font name. But fonts aren't named in a uniform way: while it's true that Times-Bold tells its weight in the part after the hyphen, that's not true of AvantGarde-Book or Helvetica-Narrow. (And those are all names from a single foundry, Adobe!)

The details of hintfiles are described in the HTML file /usr/share/doc/defoma-doc/developers.html/ch1.html. (This link works only if you copy the current Web page to a debian machine.) Although it is described as a Developers' Guide to Defoma, the guide actually is for the use of font developers (and installers), not defoma developers. The parsing of hints is described in Chapter 3 of the tutorial file:///usr/share/doc/defoma-doc/defoma-script.html/index.html.

Another important source of information is the file /usr/share/doc/x-ttcidfont-conf/README.Defoma, which gives much fine detail about the use of TrueType fonts. But there's also much useful information about XLFD names.

Defoma scripts

Instructions for writing perl scripts to allow defoma to manage additional applications are at file:///usr/share/doc/defoma-doc/defoma-script.html/index.html. That tutorial explains the internal workings of the system, including the various functions that are built into it. Additional information is in /usr/share/doc/psfontmgr/README.Defoma.

There are enough examples that even a programmer not very familiar with perl can probably put together something that works.

An outline of the general strategy for placing the various files for an application is given in file:///usr/share/doc/defoma-doc/defoma-policy.txt.

Defoma and fontconfig


A good guide to fontconfig and X11 is in the file /usr/share/X11/doc/fonts/fonts.pdf. Note that only the scalable X fonts are handled by fontconfig; the old bitmapped “core” fonts are not. Fontconfig only knows about the fonts in the directories listed in its configuration files, /etc/fonts/fonts.conf and /etc/fonts/local.conf.

Like defoma, fontconfig tries to play the font-substitution game, providing a font with approximately the right characteristics when an exact match can't be found.

Defoma and fontconfig: theory

Defoma is supposed to work well with the fontconfig library. The system is very briefly explained in /usr/share/doc/fontconfig/README.Debian; a detailed explanation of fontconfig is at the fontconfig website, or in the file /usr/share/doc/fontconfig/fontconfig-user.html.

Defoma-managed fonts are made available to fontconfig through files in the /var/lib/defoma/fontconfig.d directory, and the pointer to /var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType in fontconfig's local configuration file /etc/fonts/local.conf . The configuration file /etc/defoma/fontconfig.subst-rule is supposed to tell defoma how fontconfig handles font-substitution. The scripts /var/lib/defoma/scripts/fontconfig.defoma and /usr/share/defoma/scripts/fontconfig.defoma do the actual work.

Defoma writes fonts.conf files in font directories that point fontconfig to /var/lib/defoma/fontconfig.d. Running  fc-cache -f  then rebuilds the fontconfig database.

Defoma and fontconfig: practice

Unfortunately, the two systems use similar sets of font characteristics, but assign different values to them. For example, fontconfig describes font weights as light, medium, demibold, bold or black, while defoma prefers Semibold (instead of demibold) and Semilight, and lacks black. (See /usr/share/defoma/ for defoma's list of weights.) And some of the distributed defoma hintfiles use Regular instead of Medium.

Notice that defoma capitalizes the values, while fontconfig has them in lower case. There are other conflicts: fontconfig uses the standard term embolden, while defoma uses the barbarism boldize. And, according to /usr/share/doc/x-ttcidfont-conf/README.Debian, defoma adopts a default slant for italic fonts that's twice as big as for oblique ones; while fontconfig assumes a slightly larger slant for oblique than for italic, according to /usr/share/doc/fontconfig/fontconfig-user.txt.gz. In general, fontconfig uses terms that are finer-grained, and more consistent with standard typographical terminology. See its man page (which, unfortunately, turns out to be  man fonts.conf  rather than  man fontconfig ) for details.

Viewing fonts

gfontview  (Gnome's font viewer; drags in a lot of unnecessary Gnome libraries, but it's an excellent viewer) allows you to view TrueType and Type1 fonts.

xfontsel  shows what's available to X; but it uses the very awkward and inconvenient XLFD freight-train descriptors. If you need to find the XLFD that goes with a particular font, this is a way to do it; but it's not a good font viewer.

A better display is provided by  xfd  — but unfortunately, it requires the XLFD name for the font. If you just need to find the XLFD of a font, try using  xlsfonts  to get the name. Or, if you have just installed a Type1 font, look in the fonts.scale file created by type1inst to find its XLFD.

There used to be a GUI front-end for defoma, called  dfontmgr ; it was not a font viewer, but simply showed the information defoma has about the fonts and the applications it manages. This seems to have been abandoned.


Copyright © 2005, 2006, 2010 – 2012, 2015 Andrew T. Young

Back to the . . .
LaTeX fonts page

or the LaTeX top page

or the website overview page