Return to LinuxDig.Com HowTo's

1. Introduction

2. Fonts 101 -- A Quick Introduction to Fonts

2.1. Types of Fonts

2.1.6. Type 1 vs TrueType -- a comparison

Despite the historical feuding between the proponents to Type 1 and TrueType fonts, both have a lot in common. Both are scalable outline fonts. Type 1 fonts use cubic as opposed to quadratic curves for the glyphs. This is in theory at least a slight advantage since they include all the curves available to TrueType fonts. In practice, it makes very little difference.

TrueType fonts have the apparent advantage that their support for hinting is better ( Type 1 fonts do have hinting functionality, but it is not as extensive as that of TrueType fonts ). However, this is only an issue on low resolution devices, such as screens ( the improved hinting makes no discernable difference on a 600dpi printer, even at small point sizes. ) The other point that makes this apparent advantage somewhat questionable is the fact that well hinted TrueType fonts are rare. This is because software packages that support hinting functionality are out of the budget of most small time designers. Only a few major foundries, such as Monotype make well hinted fonts available.

In conclusion, the main differences between TrueType and Type 1 fonts are in availability and application support. The widespread availability of TrueType fonts for Windows has resulted in webpages designed with the assumption that certain TrueType fonts are available. Also, many users have large numbers of TrueType fonts because they ship with the users Windows applications. However, on Linux, most applications support Type 1 fonts but do not have the same level of support for TrueType. Moreover, most major font foundries still ship most of their fonts in Type 1 format. For example, Adobe ships very few TrueType fonts. My recommendation to users is to use whatever works for your application, and try to avoid converting from one format to another where possible ( because the format conversion is not without loss ).

3. Fonts 102 -- Typography

Here, we discuss some typography basics. While this information is not essential, many font lovers will find it interesting.

3.1. Classifications of Typefaces

3.1.3. The old and the new -- different types of Serif fonts

3.1.4. The Sans Serif Revolution

Surprisingly, the rise of sans serif fonts is a fairly recent phenomenon. The first well known sans serif fonts were designed in the 19th early 20th century. The earlier designs include Futura, Grotesque and Gill Sans. These fonts represent respectively the ``geometric'', ``grotesque'' and ``humanist'' classes of sans serif fonts.

3.1.5. Compatible Typefaces

Grouping typefaces is not easy, so it pays to avoid using too many on the one page. A logical choice of two typefaces consists of a serif and a sans serif. Monotype's Typography 101 page provides a category-matchup. They conclude that the moderns and geometrics form good pairs, while the old styles and humanists also go together well. The transitionals are also paired with the humanists. The slab serifs are paired with the grotesques, and some variants of the slab serifs are also said to match the geometrics or humanists.

From reading this, one gets the impression that their philosophy is essentially to match the more conservative serifs with the more moderate sans serifs, and pair the wilder modern serifs with the avant garde looking ( pun unavoidable ) geometrics.

3.2. Ligatures, Small caps fonts and expert fonts

4. Making Fonts Available To X

There are a number of ways fonts can be added to X. Firstly, XFree86 has a font path which is just a list of several directories or font servers where it searches for fonts. A font server is just a background process that makes fonts available to XFree86. An advantage of font servers is that they can send fonts to remote displays.

Recently, xfs ( the ``X font server'' ) has been patched to support TrueType fonts, and run as a stand-alone program. The patched version ships with RedHat and RedHat-based distributions, and is included in XFree86 4.0 and newer. xfs is actually just the standard font server that comes with XFree86. It's source code is part of the XFree86 source tree. However, distributions have recently been shipping a version that runs in stand-alone mode. The stand-alone X font server, with the TrueType support patch ( the TrueType support takes place via a font server called xfsft ) is probably the nicest font management solution currently available. Its advantages include:

Because different distributions ship with different configurations, it is not true that one size fits all. We can split users up into three groups:

4.1. The font path

XFree86 finds your fonts by searching a font path, a list of directories ( or servers -- we'll explain this further later. ) containing fonts. When an application requests a font, it searches through the directories in your font path one at a time until the font is found. To make fonts available requires you to set your font path. You can add a directory to your font path with the command xset fp+ directory Once you have done this, you need to ask the X server to re-scan for available fonts with the command
	xset fp rehash
Since you will want these commands to run automatically, you should put them in your .xinitrc file ( or possibly your .Xclients or .xsession file -- this depends on how you start X. It's convenient to make two of these files symlinks to the other to avoid confusion ). Another way to have the commands set automatically is edit XF86Config. For example, to add /usr/share/fonts/myfonts to the font path when X is started, edit XF86Config like this:
		Section "Files"
		FontPath /usr/share/fonts/myfonts
The advantage of editing XF86Config is that the resulting changes are system wide.

4.4. xfs

Some of the newer Linux distributions ship with the X font server xfs configured to run as a stand alone program. Notably, Redhat and all the redhat based distributions use this modularised xfs with TrueType compiled in. Debian also ship xfs, but the version they ship in stable ("potato") doesn't have built in true type support, though the one in testing ("woody") does.

Running xfs as a stand alone server has several benefits, especially if it is compiled with TrueType support. The main advantage is that since the font server is no longer attached to the X server, it is possible to serve fonts to remote displays. Also, it makes it much easier to modify the font path.

4.4.1. The xfs Path

As a font server, xfs has it's own font path. One might wonder where this fits into the picture. It works like this: you can place the xfs font server in XFree86's font path, by adding unix/:port to the XFree86 font path. Once you do this, any font in the xfs font path automatically becomes available to XFree86.

The xfs font path is determined by the xfs configuration file, which is /etc/X11/fs/config on Redhat, and /etc/X11/xfs/config on Debian. Redhat users do not need to explicitly edit this file, they can use the chkfontpath utility. The syntax is simple:
	chkfontpath --add directory
Users of other distributions can edit the configuration file as follows:
	catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled,
	# in 12 points, decipoints
	default-point-size = 120
The above would add /usr/share/fonts/my_new_fonts/ to the xfs font path. Note that the last line of the list of directories doesn't have a comma at the end. For these modifications to the font path to become effective, xfs must be told to reload by running /etc/init.d/xfs reload or sending it a SIGHUP with "kill -HUP [pid]" or "killall -HUP xfs". Alternately you can just re-start xfs, though if you do that it would be a good idea to re-start your X session too.

4.4.2. Installing a Font Into xfs

To prepare a font for xfs, you need to follow the following steps:

5. Making Fonts Available To Ghostscript

To make fonts available to ghostscript, it suffices to tell ghostscript where the files corresponding to a given font are located. The file that needs to be edited is /usr/share/ghostscript/version/Fontmap. The format is very simple, almost immediately self evident on perusing it.

5.2. True Type

Adding truetype fonts is a little trickier, because we have to get the name of the TrueType font. One way (brute force, alas) to do this is using the ttf2pt1 TrueType to Type 1 converter, and grabbing the font name from the afm ( there's got to be a more efficient way ! but this works, ugly as it is ). You do it like this:
		ttf2pt1 -A fontname - 2 > /dev/null  |grep FontName
Then you add an entry to the ghostscript Fontmap file in the correct format, eg some-font (/usr/share/fonts/subdirectory/somefont.pbf); Well, that works fine, but try doing it with 500 or so fonts. This is the kind of thing that calls for a short perlscript:
# ttfontmap -- generate fontmap file for TrueType fonts
my $directory=shift || print STDERR "Usage: ttfontmap {directory}\n";


for my $fontname ( glob ( "$directory/*.ttf" ) )
    open ( R, "sh -c \"ttf2pt1 -A $fontname - 2>/dev/null\" |" );
    while ( <R> )
        if ( $_ =~ /^FontName/ )
            print "/" .  $_ . "    ($fontname);\n" ;
    close R;
You can
download this script

To set this script up, all you need to do is cut and paste it into a file called ttfontmap, and place the file somewhere in your PATH ( such as /usr/bin ). You run this script like this:
	ttfontmap directory > output_file
where directory is the directory containing the fonts. You are left with the file output_file which you can append to your ghostscript fontmap. Note: some will observe that you could just use ttfontmap directory >> /usr/share/ghostscript/version/Fontmap However, I advise against this ( what would happen if you typed ``>'' instead of ``>>'' ? )

7. WYSIWYG Publishing and Fonts

7.2. Applixware

There are two ways to install fonts into Applixware. One method involves using FontTastic, which is Applixware's ``private'' font server. The other method involves editing Applixware's fontmap, to use a font already installed on the system. Installing into the font server is more convenient, but fonts installed in this manner may only be printed at 300 dpi.

7.2.2. Using System Wide Fonts With Applixware

This method is more involved, but produces better results. I recommend that this method is used for fonts that are really important, and that you use a lot. There are a few steps to this: Edit the fontmap.dir

This is the final step in making your fonts available to Applix, and also the most time consuming step. The file fontmap.dir is in under the axdata/fontmetrics of your applix installation. The purpose of this step is basically to tell applix which screen fonts go with which outline fonts. This is in general a very nontrivial problem, because the screen fonts are not always on the same computer that the application is installed.

We describe how to add fonts to fontmap.dir. In this example, we add the font Baskerville Italic.

  1. First, we add a line that says FontRecord = Baskerville-Normal-Italic In fact, the name we use in FontRecord is completely arbitrary. However, the font record must be unique to the font. Because of this, it's good practice to use the name that ghostscript uses for the font.

  2. Next, we a line that says Family = Baskerville The family name for a font is the name that appears in Applix's font selection menu. Typically, it is non-unique, since bold, italic, roman and bold-italic variants of a font will typically go under the same family.

  3. If the font is either a bold, or italic variant, or both, we need to add the following lines: Slant = 1 if the font is italic, and Weight = 1 if the font is bold. If the font is bold and italic, we add both lines. In this example, we need only add the line Slant = 1

  4. We add a line that looks like this: ScreenName = "-paradise-baskerville-medium-i-normal--0-0-0-0-p-0-iso8859-1" The screen name is the name that the X-server uses for the font. We can list font names containing the string ``bask'' by typing xlsfonts|grep -i bask

  5. Now we add a line that gives the name of the printer font: PostScriptPrinterName = Baskerville-Normal-Italic

  6. Next, we need to specify the location of the font metric file and the outline file MetricsFile = /usr/share/fonts/misc/baskvli.afm Type1FontFileName = /usr/share/fonts/misc/baskvli.pfb If you are adding a TrueType file, you can use ttf2pt1 to generate an afm file : ttf2pt1 -A foo.ttf - > foo.afm ( or get the ttfutils package and use ttf2afm ) Then you use something like this: MetricsFile = /usr/share/fonts/misc/foo.afm Do not include a Type1FontFileName directive -- let ghostscript take care of this.

That's it. Now after adding the whole family of fonts, you should have something like this:
	FontRecord = Baskerville-Normal
	Family = Baskerville
	ScreenName = "-paradise-baskerville-medium-r-normal--0-0-0-0-p-0-iso8859-1"
	PostScriptPrintName = Baskerville-Normal
	MetricsFile = /usr/share/fonts/misc/baskvl.afm
	Type1FontFileName = /usr/share/fonts/misc/baskvl.pfb

	FontRecord = Baskerville-Normal-Italic
	Family = Baskerville
	Slant = 1
	ScreenName = "-paradise-baskerville-medium-i-normal--0-0-0-0-p-0-iso8859-1"
	PostScriptPrintName = Baskerville-Normal-Italic
	MetricsFile = /usr/share/fonts/misc/baskvli.afm
	Type1FontFileName = /usr/share/fonts/misc/baskvli.pfb

	FontRecord = Baskerville-Bold
	Family = Baskerville
	Weight = 1
	ScreenName = "-paradise-baskerville-bold-r-normal--0-0-0-0-p-0-iso8859-1"
	PostScriptPrintName = Baskerville-Bold
	MetricsFile = /usr/share/fonts/misc/baskvlb.afm
	Type1FontFileName = /usr/share/fonts/misc/baskvlb.pfb     

	FontRecord = Baskerville-Bold-Italic
	Family = Baskerville
	Weight = 1
	Slant = 1
	ScreenName = "-paradise-baskerville-bold-i-normal--0-0-0-0-p-0-iso8859-1"
	PostScriptPrintName = Baskerville-Bold-Italic
	MetricsFile = /usr/share/fonts/misc/baskvlbi.afm
	Type1FontFileName = /usr/share/fonts/misc/baskvlbi.pfb     

It is possible to do more with this configuration file. The file itself has a glossary which explains the format of the configuration file.

7.3. Star Office

Here, we cover Star Office 5.0. The procedure with Star Office 5.1 is similar, but the utility is called spadmin, not psetup. It's worth mentioning up front that John McLaughlin's page is an excellent source on this issue, and it inspired most of what follows.

Having tried both Star Office 5.0, and 5.1, I have found that Star Office 5.1 seems to give me less grief when adding new fonts. I was not succesful adding true type fonts to Star Office 5.0, but it proved somewhat easier with Star Office 5.1.

7.3.3. Adding TrueType Fonts to Star Office

Adding TrueType fonts to Star Office is nontrivial, but possible. After some hard work, and long hours stareing at John McLaughlin's page page, I finally got them working in Star Office 5.1. Note that this does not work with version 5.0. The following steps are appropriate it you are printing through ghostscript:

  • Make the fonts available to X.

  • Make the fonts available to ghostscript.

  • You need to have afm files for the fonts you wish to add. Use
    	ttf2pt1 -A foo.ttf - > foo.afm
    to create the afm files. Alternatively, you can get the

  • ttfutils package and use ttf2afm The advantage of this is you can handle several at a time, eg
    	ttf2afm *.ttf

  • Star Office needs pfb files corresponding to each ttf file. You can create them with the command
    	touch foo.pfb
    Actually, Star Office only uses these files for printing purposes. And by enterring the font in the PPD, thus duping Star Office into thinking the fonts are inside your printer ( when they're actually inside ghostscript's rendering system ), you get around needing to use these files. Star Office just seems to require that the pfb file exists to install the font.

  • Now you can run spadmin and install the font(s).

  • Now add the fonts to the PPD file corresponding to your printer configuration. The name you use for the font should be the same name Star Office uses for it, not the ghostscript font name. For example, if the font is foobar.ttf and the corresponding afm file is foobar.afm, you use the name ``foobar'' for the font in the PPD file. The entry should look something like this:
    *Font cloistrk: Standard "(001.002)" Standard ROM

On the other hand, if you are not printing from ghostscript, you have different issues to deal with. In this case, tricking Star Office into thinking that your printer has the fonts is a bad idea, because your printer does not have the fonts in the ROM, so while gv will display the PostScript files nicely, your printer will not be able to print them. If you have a PostScript printer, the main differences are as follows:

  • Do not edit the PPD file.

  • Instead of using touch foo.pfb to create empty pfb files, you need the pfb files to be Type42 PostScript fonts. A Type42 font is really a ``printer TrueType font''. You don't really notice Type42 fonts even when you use them, because most applications handle them transparently. To create Type42 fonts, you use ttfps to create the files.
    	ttfps foo.ttf foo.pfb

There are some gotchas. Sometimes, Star Office might not choose the screen font you like. It is sometimes worth checking xp3/psstd.fonts and possibly editing it to make sure that Star Office is really using the font you had in mind for screen display. Also, Star Office doesn't handle configuration problems gracefully. If there's something wrong with your configuration, it's possible that the word processor will not even start. This is why you should back up your xp3 directory.

7.4. Word Perfect

Nothing yet. Rod Smith's webpage is the definitive resource regarding installing fonts on Word Perfect.

9. TeX / LaTeX

9.1. A Quick Primer on LaTeX/TeX fonts

Adding fonts to TeX and LaTeX is a somewhat complex procedure. However, like a lot of things, it's easy if you know how to do it. Some fonts are distributed in metafont format, and some in Type 1 format. Usually, the Type 1 formats are more easily available. However, metafont fonts have the distinct advantage that they can adjust their shape at different sizes, while Type 1 and TrueType fonts at different point sizes are simply magnified or reduced versions of precisely the same shape. The main reason why this feature is desirable is that ideally, fonts should be ( relatively ) wider at smaller sizes and narrower at larger sizes.

For this discussion, we focus on Type 1 fonts, since they are more widely available, and more problematic to install.

Here's a quick primer on LaTeX fonts. LaTeX uses the following types of font files for handling Type 1 fonts:

It's good to know your way around the TeX directory structure. Here are the main directories you'll need to know about:

  • $TEXMF/fonts -- the main font directory

  • $TEXMF/fonts/type1 -- the type1 font directory

  • $TEXMF/fonts/type1/foundry -- the directory for the shape files in a given foundry

  • $TEXMF/fonts/type1/foundry/fontname -- contains the font called name. The name is usually plain English, and needn't follow TeX's cryptic naming scheme for fonts.

  • $TEXMF/fonts/afm/foundry/fontname -- the directory containing the afm files corresponding to the font name belonging to foundry foundry.

  • $TEXMF/fonts/tfm/foundry/fontname -- analogous to the afm directory, but contains tfm files instead.

  • $TEXMF/fonts/vf/foundry/fontname -- similar to the above, but contains the virtual fonts.

  • $TEXMF/fonts/source/foundry/fontname -- similar to the above, but contains metafont files.

  • $TEXMF/dvips/config/ -- fontmap file for dvips. This file is similar in both function and format to ghostscript's Fontmap file.

  • $TEXMF/tex/latex/psnfss -- this is where all the font definition files go.

9.2. Adding Type 1 fonts

10. Getting Fonts For Linux

10.2. Type 1 Fonts and Metafont

10.2.2. Free Stuff

ctan have a number of good fonts, many of which are free. Most of these are in Metafont format, though some are also Type 1 fonts. Also, see Bluesky who have made available Type 1 versions of the computer modern fonts. ( The computer modern fonts are of excellent quality -- to purchase anything of comparable quality and completeness will cost you around $500-. They are comparable to the premium fonts. )

Luc Devroye's webpage has links to several sites with free fonts available. What's unique about these fonts is that a lot of them are really free, they are not ``warez fonts''.

URW have released the standard PostScript fonts resident in most printers to the public domain. These fonts are quite good.

The Walnut Creek Archive has several freely available fonts, and shareware fonts. Some of these are obvious ripoffs ( and not very good ones ). If a font doesn't come with some kind of license, chances are it's a ripoff. Also Winsite have several Type 1 fonts ( in the fonts/atm subsection of their windows 3.x software ). Unfortunately, several of these have afm files which have mistakes and are missing all kerning pairs ( you can fix the afms by editing the "FontName" section of the afm files. It should match the fontname given in the font shape file. Of course, adding kerning pairs is a topic beyond the scope of this document. )

Luc Devroye's webpage includes several free fonts he designed, as well as a lot of links, and fascinating discussion on the topic of typography. This site is a ``must-visit''. There are also several links to many foundries.

10.2.3. Commercial Fonts Value vs Premium: Why Should I buy Premium Fonts ?

So you're wondering -- why do some fonts cost a lot and others are cheap ? These fonts are the ``standard PostScript fonts'' resident in most PostScript printers. Also the famous Why should I buy the more expensive ones ? My take on it is that for a casual user, the value fonts ( such as those on the Bitstream CD ) are just fine. However, if you're using the fonts for ``real work'', or you're just a hard core font junkie, then the better quality fonts are a must-have -- and most of the quality fonts are either free ( for example, Computer Modern ), or they are upmarket commercial fonts.

The advantage of the cheaper fonts is self evident -- they are cheaper. The quality fonts also have their advantages though. Value

  • An excellent place to go for a CD packed with several Type 1 fonts of reasonable quality is Bitstream. Bitstreams more noted products include their 250 font CD and their 500 font CD ( the latter goes for $50- at the time of writing ). These are fairly good quality fonts, and are a fairly good starting point for the casual user. The fonts used in Corel's products are (mostly) licensed from bitstream.

  • Matchfonts offer more modestly priced fonts -- they are distributed in ``packs'' of about 8 fonts for $30. This includes some nice calligraphic fonts. All fonts seem to be offered in a usable format ( the windows ATM fonts come in a .exe file. Don't let the extension fool you -- it's just a zip archive ). These are not ripoffs as far as I can tell.

  • EFF sell TrueType fonts for $2- per hit. They also have ``professional range'' PostScript and TrueType fonts for $16- per typeface. Premium

  • Adobe have several high quality, fonts available at Adobe's type website. Some of these are expensive, but they have several more affordable bundles -- see Adobe Type Collections. Adobe have some of the most complete font families on the market, for example, Garamond, Caslon, and their multiple masters ( Myriad and Minion, used on their website are among the nicer of their multiple masters. )

  • Berthold Types Limited is a major foundry, who offer several quality fonts. Some of them are resold through Adobe, all are directly available from Berthold. Same price ballpark as Adobe.

  • ITC develop several quality fonts ( including some of the ones Corel ships with their products ) at They offer family packages for about $100-180 US. Their fonts, come in both Type 1 and TrueType format. It's better to choose the ``Windows'' package, because Mac formats are difficult to handle on Linux.

  • Linotype are a well known foundry who offer fonts by legendary designers including Herman Zapf. ( yep, the guy ``Zapf Chancery'' is named after. He also designed Palatino. )

  • Monotype develop most of the fonts shipped with Microsoft products. One of the older and well respected foundries.

  • Tiro Typeworks sell good quality, if somewhat expensive typefaces. Their typefaces are very complete, for example, they include complete sets of ligatures, and smallcaps, titling fonts, etc. UNIX is listed as one of the OS options -- which is a welcome surprise after seeing the words ``Windows or Mac'' too many times..

11. Useful Font Software for Linux

There are several font packages for Linux. Many of them are essential.

  • chkfontpath is a utility for manipulating the xfs configuration file.

  • DTM -- the Definitive Type Manager is a global font management tool. This is a developer's release.

  • fontinst is a LaTeX package designed to simplify the installation of Type 1 fonts into LaTeX.

  • Freetype is a TrueType library that comes with most Linux distributions

  • Ghostscript is the software that is used for printing on Linux. The version of ghostscript that ships with Linux is GNU ghostscript. This is one version behind the latest release of Aladdin ghostscript ( who release their old versions under the GPL )

  • pfm2afm is a utility for converting windows pfm font metric files into afm metrics that can be used for Linux. This is based on the original version available at CTAN, and includes modifications from Rod Smith to make it compile under Linux.

  • mminstance and t1utils are two packages for handling Type 1 fonts. mminstance is for handling Adobe's multiple master Type 1 fonts. t1utils is a suite of utilities for converting between the different Type 1 formats.

  • ttf2pt1 is a TrueType to Type 1 font converter. It is useful if you have applications that require Type 1 fonts.

  • ttfps converts .ttf TrueType font files into Type42 files.

  • ttfutils A package of utilities for handling TrueType fonts. This package requires ttf2pt1. Useful if not essential.

  • type1inst is an essential package for installing Type 1 fonts. It greatly simplifies the installation.

  • xfstt is a TrueType font server for Linux. It's useful, but xfs is probably a better choice.

  • xfsft The xfsft font server. Note that this is included in xfs.

  • x-tt is a font server designed to handle Korean and Japanese fonts.

12. Ethics and Licensing Issues Related to Type

Font licensing is a very contentious issue. While it is true that there is a wealth of freely available fonts, the chances are that the fonts are ``ripoffs'' in some sense, unless they come with a license indicating otherwise. The issue is made more confusing by intellectual property laws regarding typefaces. Basically, in the USA, font files are protected by copyright, but font renderings are not. In other words, it's illegal to redistribute fonts, but it's perfectly legal to ``reverse-engineer'' them by printing them out on graph paper and designing the curves to match the printout. Reverse engineered fonts are typically cheap and freely available, but of poor quality. These fonts, as well as pirated fonts are often distributed on very cheap CDs containing huge amounts of fonts. So it's not always easy to tell if a font is reverse engineered, or simply pirated. This situation creates an enormous headache for anyone hoping to package free fonts for Linux.

Perhaps one of the most offensive things about the nature of font piracy is that it artificially debases the value of the work that type designers do. Pirated fonts invariably are bundled en masse onto these one zillion font CDs, with no due credit given to the original designers. In contrast, what is commendable about several legitimate font foundries is that they credit their designers.

There are many differing opinions on this issue. See typeright for an explanation of the case in favour of intellectual property rights. Also, see Southern Software, Inc for another opinion -- but don't buy any of their fonts! Their Type 1 fonts ( poorly reverse-engineered Adobe fonts ) do not have AFMs, and are thus unusable.

The comp.fonts FAQ also discusses the issues of fonts and intellectual property, as does Luc Devroye's homepage. These references are somewhat less extreme in their views.

13. References

13.1. Font Information

13.2. Postscript and Printing Information

14. Glossary