Furthermore, there is a effort to replace defoma with fontconfig; see http://wiki.debian.org/OldPkgRemovals#defoma. 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, https://wiki.debian.org/Fonts, 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.
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.
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.
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.
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.
Let's first see where all the pieces are hidden:
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:
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.
As you would expect, the configuration files for defoma are in /etc/defoma. Several kinds of information are provided:
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.
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.
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-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.
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.
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
or the
LaTeX top page
or the website overview page