# Font Installation

This page concerns font installation. That is, it includes information and resources for those trying to install additional fonts for use with TeX. For general information about fonts in TeX, see Fonts. For information about font selection and usage, see Font Selection. For information about specific typefaces, see Typefaces.

## Background

In most cases, installing a font in /Library/Fonts or in your personal Fonts folder is not sufficient to enable the font for use with TeX. An exception to this is the use of the XeTeX engine which can use many fonts available to Mac OS X directly. See Using fonts with XeTeX for details. To use a font with any of the other engines, the font must be installed for use by TeX along with an appropriate set of support files.

Note that your TeX Distribution probably includes a large number of fonts already. Browse the documentation installed on your system for details and note that fontsampler may also be helpful in discovering what you already have available. The TeX Live distribution includes the scripts getnonfreefonts and getnonfreefonts-sys which can be used to easily install a selection of additional fonts.

If you need to use a font not included in your distribution (or installable using getnonfreefonts/getnonfreefonts-sys), CTAN's collection of fonts is the best place to start. Fonts available from CTAN are usually packaged with all of the support files you need to install and use the font with TeX. Follow the package's instructions for installation details. You will need to consult the documentation for your TeX Distribution to find out where to install the files.

If your distribution uses the TDS set up - if you are using TeX Live, for example - you should install the files in one of two locally managed trees. By default these are:

1. `/usr/local/texlive/texmf-local`;
2. `{HOME}/Library/texmf`

if you installed the MacTeX distribution, for example.

Installing in `/usr/local/texlive/texmf-local` has the advantage that the package will be available to all users. On the other hand, installing in your personal texmf tree is more straightforward and does not require administrative privileges. If you install in `/usr/local/texlive/texmf-local`, you must update the TeX database. Usually this is done using:

`mktexlsr /usr/local/texlive/texmf-local`

with root privileges (for example, using `sudo` or `sudo -H`) after installing the package files but before updating the font map files.

Wherever you install the package files, you must also update the font map files. If you install in `/usr/local/texlive/texmf-local`, you should use `tlmgr` and/or `updmap-sys` to enable the fonts. If you install into your personal TeX tree, `updmap` may be more appropriate but opinion is divided on this issue as the use of `updmap` can lead to complications later. If you do not have write access to /usr/local/texlive/texmf-local, then you cannot use `tlmgr` or `updmap-sys` in any case.

Suppose that you have installed a set of fonts and support files which includes the map file, fantasticfont.map. You have updated the TeX database if appropriate and are ready to update the font map files. If the package includes fonts in metafont format - that is, files with the extension `.mf` which you installed in `.../fonts/source/...` - as well as fonts in outline format - files with the extension `.pfb`, for example, which you installed in `.../fonts/type1/...`, say - then you would enable the fonts using one of these commands:

`updmap-sys --enable MixedMap fantasticfont.map`

with root privileges (e.g. using `sudo` or `sudo -H`), or

`updmap --enable MixedMap fantasticfont.map`

without. If the package contains the fonts in outline format only - all the font files have the extension `.pfb`, for example, and are installed under `.../fonts/type1/...` - then you would use one of these commands:

`updmap-sys --enable Map fantasticfont.map`

with root privileges, or

`updmap --enable Map fantasticfont.map`

without. A useful alternative if you need to enable/disable many font maps - or if you need to change other font options - is the `--edit` option for `updmap-sys`/`updmap` or tlmgr followed by `updmap-sys`:

For TeX Live 2008 or earlier:

`updmap-sys --edit`

with root privileges (e.g. using `sudo` or `sudo -H`), or

`updmap --edit`

without. These commands open up the relevant `updmap` configuration file for editing. Instead of enabling/disabling font maps by naming them on the command line, you can add to or subtract from the list of map files directly and/or alter other settings. The configuration file is well commented so it is a good idea to read the instructions it contains in any case. If you make changes to the file, `updmap-sys`/`updmap` will update everything after you finish editing. If the file is unchanged, it will detect this and leave things as they are.

If you are using TeX Live 2009 or later, a better method is available which will avoid your losing your local additions if you update the distribution using tlmgr. Either add each map file individually using the `--enable` option as explained above or, instead of using the `--edit` option to `updmap-sys`, create a local configuration file `TEXMFLOCAL/web2c/updmap-local.cfg`. You do not need to copy the original configuration file and edit it - this file should contain only your local additions. For example, you might add the line

`Map fantasticfont.map`

`tlmgr generate updmap`

with root privileges, and then:

`updmap-sys`

with root privileges to propagate your changes.

## Installing arbitrary fonts

If the font you need does not come with the support files needed to install it for TeX and no complementary TeX package is available, various tools are available to generate the required files. Many fonts can be used with TeX if you are prepared to go to the trouble of installing them. If you use pdfTeX, you can use a wide range of readily available typefaces including both type 1 and TrueType fonts without needing to convert them. Generating the required support files is not, however, a simple task. This is especially true for many of the widely available freeware TrueType fonts which are often poorly constructed. Nonetheless, high quality examples certainly exist and the richer variety of typefaces available to you may constitute sufficient compensation for the frustration you are likely to encounter in struggling to install them. Even some fonts with existing support may produce output more to your liking with a customised installation. For example, some fonts provide oldstyle/hanging figures but the provided packages only support lining digits. In this case, a custom set-up can offer access to both styles.

If you do not wish to tangle with font installation yourself, consider using XeTeX for those cases in which you wish to use a font without ready-made TeX support and choose from the wide range of fonts which do come with such support when you need to use TeX, eTeX or pdfTeX instead.

The descriptions below outline the various steps needed to prepare the fonts and support files for installation and use with TeX:

1. Convert Mac fonts: only necessary if fonts are in a Mac-specific wrapper, such as many of those supplied with Mac OS X.
2. Convert fonts/Produce AFMs: not necessary if the font is in type 1 format (`.pfb` or `.pfa`), as it should already come with an `.afm`.
3. Generate (La)TeX support files

### Convert Mac fonts

If you wish to use the fonts supplied with Mac OS X - or any other fonts provided in Mac-specific formats - you must generally unpack them before generating the TeX support files. FontForge and fondu can unpack many Mac-specific formats. GTAMacfonts, a package available through i-Installer can automate this process for a selection of standard Mac OS X fonts, as well as installing the required TeX support files and updating the TeX database and map files.

### Convert fonts/Produce AFMs

If you plan to use the font with eTeX as opposed to pdfTeX or luaTeX, you will need the font in postscript type 1 (or metafont) format. Tools such as font2afm and FontForge can be used to convert fonts from other formats, subject to any licensing restrictions. pdfTeX (and so luaTeX) can also use TrueType fonts directly. If you intend to use TrueType fonts with pdfTeX, you will still need to generate at least one Adobe Font Metric (`.afm`) file for each TrueType font. Various utilities can do this, including ttf2afm and font2afm, although you may find that certain ways of generating the Adobe Font Metric files works better with a particular font than others. For example, FontForge can sometimes produce useful Adobe Font Metrics for TrueType fonts which ttf2afm cannot cope with as easily.

### Generate (La)TeX support files

Various strategies and utilities are available to the braver and/or more foolhardy adventurer faced with an unsupported font and endowed with more than her/his fair share of persistence/determination/stubbornness/sheer bloody-mindedness. The best method in any particular case will depend in part on the format of the font and in part on other considerations, such as the specific TeX engine and format the font will be used with. Although it is possible to convert fonts from one format to another, many font licences forbid this and, even if the licence allows conversion, using the font in its original format may yield better results.

The choice also depends on the result you wish to achieve and, to some extent, on personal preference. If you wish to create a highly customised set-up, you need to choose a tool which will allow you to specify a suitably detailed configuration. If you want to enable additional ligatures, contextual swashes or alternates, for example, you are likely to need a tool which allows you to control the process quite carefully. The same may be true if the fonts use non-standard glyph names or if you want to combine hanging figures from one font with letters and symbols from another. If speed and simplicity are more important, you may prefer a tool with a more automatic mode. Some utilities, such as fontinst offer both an automatic mode and a mode which supports a high degree of customisation.

#### afm2pl/pltotf

A combination of afm2pl and pltotf can be used to create some LaTeX support files for (at least) postscript type 1 (`.pfb`) files although you will still need to produce font definition (`.fd`) files separately. It can also be used for truetype fonts provided you have obtained suitable Adobe Font Metric (`.afm`) files as explained above.

`afm2pl` reads a suitable `.afm` file, possibly an encoding file (`.enc`) and perhaps additional lists of ligatures and kerns (`.lig`) and produces a `.pl` file which can be converted to a TeX Font Metric (`.tfm`) file by `pltotf`. It also produces a map file fragment. A typical invocation might look like this:

`afm2pl -p texnansi.enc ybdr.afm ybdr8y.pl`

This tells `afm2pl` to create `ybdr8y.pl` from `ybdr.afm`, re-encoding the font using the encoding specified in `texnansi.enc` (the TeXnANSI/LY1 encoding). `afm2pl` will also produce `ybdr8y.map` containing the appropriate line for use in map file generation.

A slightly more complex invocation might be:

`afm2pl -V -l ybd.lig -n -p texnansi-ybd.enc ybdr.afm ybdr8y.pl`

This uses an encoding presumably specified in `texnansi-ybd.enc`. This might be necessary if some characters are named differently in `ybdr.afm` than in `texnansi.enc` or if you wish to adapt the encoding by using the empty slots for additional ligatures, for example. `-l ybd.lig` tells `afm2pl` to use the ligaturing and kerning information from `ybd.lig` in addition to any in the `.afm` rather than `afm2pl`'s default. `-n` tells it not to bother searching for `afm2pl-texnansi-ybd.enc` or `afm2pl-ybd.lig` but to use the files with the exact names specified on the command line. Finally, `-V` will produce a warning if any of the characters listed in the encoding are not available in the font.

Like the fontinst method described below, this method allows you to create a highly customised installation. Fancy ligatures, alternate characters and kerning adjustments can be specified precisely and encoding files can be adjusted to accommodate the particular fonts you are working with. See the manual page for full details.

Unlike the fontinst method, this method does not rely on virtual fonts. However, it is also unable to produce fake small capitals or to combine characters from different fonts into a single TeX font as `fontinst` can do. `fontinst` is therefore probably a better choice if a font lacks optical small caps and you wish to fake them or if you have a font family in which the oldstyle digits and small capitals are in separate fonts, for example.

Also unlike `fontinst`, `afm2pl` is unable to fake glyphs or to make up for missing font information. This is not too much of a concern if the font you are installing has a full complement of characters but if, for example, your font lacks the `ffl` ligature or `acircumflex`, `afm2pl` will simply leave an empty slot leading to gaps in typeset documents whereas `fontinst` will create fake glyphs for otherwise empty slots whenever possible. `fontinst` will also ensure that certain information TeX needs in order to use a font is supplied even if the font does not include it itself whereas `afm2pl` will simply omit the information leading to fatal errors when typesetting. For these reasons, `fontinst` is probably a better choice if you need to install poorly designed or buggy fonts or if the fonts simply do not support a full complement of the characters TeX expects.

If you do not need these features of `fontinst`, however, you may prefer the relative simplicity of `afm2pl` and its faster execution time.

If you use `afm2pl` to produce a number of `.pl` files, you will find you end up with an equal number of `.map` file fragments. Whereas a single run of `fontinst` can be designed to combine the information for all font files produced in a single `map` file fragment, `afm2pl` will always produce a separate `.map` file for each `.tfm`. You will therefore probably wish to combine the contents of all of these `.map` files into a single file for ease of installation using `updmap` or the like.

#### fontinst/pltotf/vptovf

A combination of fontinst, pltotf and vptovf can be used to create LaTeX support files for (at least) postscript type 1 (`.pfb`) and TrueType (`.ttf`) fonts given an appropriate set of instructions and Adobe Font Metric (`.afm`) files.

The Font Installation Guide is an especially helpful resource in this respect. Although it covers only postscript fonts and its instructions will not work for TrueType fonts without adaptation, the changes required are mostly minor, although a few methods do need more drastic alterations.

I (--Cfr 23:33, 26 September 2008 (UTC)) have found this combination of tools to be extremely powerful and flexible. It is possible to do a great deal with fontinst if you have the patience to prepare the input files carefully and experiment a little.

There are a great many wrinkles involved, though, and the learning curve may be quite steep depending on the nature of your chosen project. There are certainly things which I know are possible but which I still do not know how to achieve. The Font Installation Guide, despite the complexity of the later examples it considers, reveals only a little of what fontinst can do and I do not know of any similarly transparent documentation exploring its features further. Much of what I have learnt to do, I learnt to do by piecing together disparate hints, by looking at examples and, above all, through trial and error. More savvy users will very likely find this description at odds with their experiences. It is, after all, just my experience - that is, the experience of a user rather than the experience of a TeXpert, somebody familiar with the internals of TeX or someone with any knowledge of computer programming.

One reason to use fontinst with hand-crafted input files is that it allows you to tailor the installation to the specific font(s) you are working with or to customise the set-up according to your needs and preferences. It is possible, for example, to enable fancy ligatures and contextual swashes of various kinds for a font or a range of variants using different sets of figures. I installed Skia, which is included with Mac OS X, for use with TeX in such a way that the fancy letter combinations it includes are accessible as a special variant while regular lettering can be used with any of the six sets of figures included (oldstyle proportional and tabular, lining proportional and tabular, superior and inferior). This is not necessarily possible if fonts are installed using more automated approaches.

An advantage of `fontinst` over afm2pl, as explained above, is that `fontinst` can produce fake small capitals and a range of fake glyphs, including standard ligatures, if the font does not provide them, as well as ensuring that all the basic information TeX needs to use a font is provided. A certain degree of caution is necessary, however. Just because `fontinst` can make up for many deficiencies in the original font, it does not follow that it does a good job of doing so. `fontinst` will try to make reasonable guesses about the font based on the information it does have, but, if all else fails, it substitutes a default value. This may or may not work well for the particular font you have. Similarly, some fake glyphs are more successful than others. If the font provides an `A` and a `circumflex` but no `Acircumflex`, `fontinst` will likely do a good job of faking one. But if the font lacks the `euro` symbol, you will probably prefer to use one from another font in any case as the faked glyph is unlikely to be satisfactory.

A further advantage of `fontinst` over `afm2pl` is that it generates more of the necessary support files. In particular, it can be used to create a single `.map` fragment for an entire group of font families, if desired, and will generate font definition (`.fd`) files automatically.

`fontinst`'s generation of virtual fonts - or, rather, the human-readable `.vpl` files which can be converted to them by `vptovf` - is both an advantage and a disadvantage. On the one hand, `fontinst` can generate virtual fonts, whereas `afm2pl` cannot. This allows the production of fake small capitals; single TeX fonts which include glyphs from different base fonts (e.g. hanging figures from one font and everything else from another); and so on. On the other hand, `fontinst` always produces virtual fonts, even when there is no need for them.

#### LCDF Typetools/autoinst/otfinst

LCDF Typetools can be used to generate all required TeX support files needed to use a TrueType or OpenType font with LaTeX, optionally installing the font as well. autoinst can automate the process. This method is particularly useful for OpenType fonts as it is possible to specify which advanced features you wish to have switched on.

I (--Cfr 16:35, 27 September 2008 (UTC)) was never as comfortable with this approach as I would have liked. In many cases, I found a great many different fonts were produced corresponding to different features - even when I knew the originals did not support those features. I also found it less than straightforward to prevent autoinst from setting things up so that everything would be automatically installed. This is especially annoying if you would prefer to install things in `~/Library/texmf` or `/usr/local/texlive/texmf-local`, for example, rather than the default location. Since the utilities may well have been updated since I experimented with them, things may well have improved by now.

An alternative to autoinst is otfinst.

## Resources

### Font Installation Guide

by Philipp Lehman

Guide: open source (GFDL, no invariant sections, no front-cover texts, no back-cover texts)

Examples: open source (LPPL)

Documents the process of installing fonts in postscript type 1 format for use with LaTeX using a set of standard tools. The guide provides a number of step-by-step examples which take the reader from initial possession of a font family all the way through to updating the TeX database files. Examples range from the simplest to moderately complex cases. The example source files may be useful even if you are not working with the same fonts as the author as some of them are of general relevance while others can be easily adapted if you are faced with a similar font family.

Coverage includes:

• renaming the font files
• using fontinst's `\latinfamily` macro
• using fontinst's other macros to emulate `\latinfamily`
• using fontinst's other macros for more complex situations e.g. optical small caps, oldstyle numerals, expert fonts, the Euro symbol, TeX Companion symbols, (arbitrary) symbol fonts
• creating human-readable font definitions (`.fd`), property lists (`.pl`) and virtual property lists (`.vpl`)
• converting human-readable font metric files (property lists) to TeX font metric (`.tfm`)
• converting human-readable virtual property lists to virtual fonts (`.vf`)
• creating map files
• writing a suitable style (`.sty`) file
• installing the fonts and support files

Note that much of the guide can be used with only minor changes if you are installing a truetype (`.ttf`) for use with pdfLaTeX, but that some methods cannot be adapted without more drastic surgery.

The Font Installation Guide is included in MacTeX.

### Font installation the shallow way

by Siep Kroonenberg

From TUGboat 2006 Vol. 27 No. 1 - Proceedings of EuroTeX 2006. Pages 66-70. Quick and dirty font installation with afm2tfm and afm2pl.

### Fontname

by Karl Berry

Open source (GPL)

The font-naming scheme for TeX. Although it is not always necessary to rename fonts according to this scheme, it is sometimes essential and often helpful. For example, the `\latinfamily` fontinst macro requires fonts named according to the standard scheme.

Fontname is included in TeX Live.

### Installing Fonts for LaTeX on OS X

by Bruno Voisin (with help from Bob Kerstetter)

Included in MacTeXtras.

### ﻿﻿LaTeX 2ε font selection

by the LaTeX3 Project Team

Open source (LPPL)

Using and installing fonts for use with LaTeX 2ε.

This document is part of LaTeX 2ε and, hence, is included in TeX Live.

### Installing Times New Roman

If you need to use Times New Roman and you neither wish nor need to learn about font installation for independent reasons at this point in your life, try How to Use Times New Roman in pdflatex on Mac OS X. This provides step-by-step instructions without worrying about explanations or flexibility. It is aimed at those who need to install Times New Roman and just Times New Roman because they have to and tries to make the process as short and non-sour as possible.

### Mac OS X Fonts in pdfTeX

by Gerben C. Th. Wierda, Thomas A. Schmitz and Adam T. Lindsay

From The PracTeX Journal 2006 No. 1. Describes the creation of the GTAMacfonts package.

### Using TrueType fonts with TeX via Postscript Type 1 format

by Harald Harders

Unknown licence

Describes a method for using TrueType fonts with TeX by first converting them to postscript type 1 format. Because the fonts are converted, this method will work with TeX/eTeX as well as pdfTeX.

Note that many font licences prohibit conversion to other formats and that converting between one format and another sometimes involves a loss of quality or information.

This document is included in TeX Live.

### Virtual Fonts - a Tutorial

by Thomas Schmitz

Open source (LPPL)

Billed as a step-by-step guide to creating and using virtual fonts for non-wizards.

### Virtual Fonts: Great Fun, Not for Wizards Only

by Yannis Haralambous

From MAPS 1993 No. 10 (93.1). Pages 114-119.

### Virtual Fonts: More Fun for Grand Wizards

by Donald E. Knuth

Unknown licence

A guide to creating and using virtual fonts for wizards.