# Installing OpenType Fonts in LaTeX with the LCDF Typetools John Owens

The goal of this document is to describe how to install OpenType fonts for use with LaTeX. This is described in a recent TUGboat article. To do so I used the wonderful LCDF Typetools and some scripts of my own. I should note the XeTeX typesetting system, for Mac OS X, uses OpenType fonts directly, and Marc Penninga's fontools (written in Perl) addresses many of the same issues that we address here (if you're a Perl hacker you might prefer that tool), and if you are specifically interested in Minion Pro you may prefer the very detailed and feature-rich MinionPro package (CTAN packages: CTAN://fonts/minionpro/, CTAN://fonts/minionpro/MinionPro.pdf, and CTAN://fonts/mnsymbol/MnSymbol.pdf).

My specific setup is an Apple Macintosh running OS X (tested on both 10.3 and 10.4, but now I'm on 10.4 exclusively). I use the MacPorts distribution of TeTeX, specifically release 3 (3.01 in particular), which includes a kpathsea binary not included in release 2. I've also used the fink distribution in the past. My source fonts were from the Adobe Type Classics for Learning, and from the voluminous Adobe "Kepler" font family (thanks to Thomas Phinney of Adobe); I have also tested with two families from FontFont (thanks to Jeff Sinclair of FontFont) and am working on testing a series of font families from Monotype, Linotype, and ITC (thanks to Allan Haley of Monotype). The script is designed to work on most OTF fonts/font families and any reasonably recent LaTeX distribution. I would like to continue to test and improve the script with font families from other vendors.

At this time the tools only work with PostScript-flavored OpenType fonts; TrueType-flavored fonts are partially but not wholly supported for lengthy, complex, and detailed reasons regarding TeX font handling (not otfinst or otftotfm) that I won't get into here.

I use the MacPorts version of the LCDF typetools. (To make the LCDF source package work with a TeTeX distribution, use "configure --with-kpathsea=/opt/local" [for a MacPorts installation] or "configure --with-kpathsea=/sw" [for a Fink installation].)

Below I use Adobe Caslon as an example without opticals and Adobe Minion as an example with opticals; other fonts are hopefully straightforward (Adobe Garamond also is listed at the end).

# Goals

• My original fonts were Adobe Pro OTF fonts and had nifty features that I wanted to use. In particular I wanted a nice way to use old-style (text) figures. Besides old-style/lining numerals, the script also is tested with opticals, swashes, and inferior/superior/proportional figures.

• I wanted a simple installation method that could easily be extended to other fonts and setups if necessary.

• I wanted to avoid the complexity of fontinst, which is frankly pretty complicated, and only handles afm files besides. The LCDF tools go a long way toward making it easier.

# Wrapper Script around otftotfm

The first specific tool that is useful for installing OpenType fonts is "otftotfm", which comes with a nice "-a" automatic installation flag that places its output files in the proper places in the tetex tree. The second useful tool, also from LCDF, is "otfinfo", which reports attributes of OTF fonts. Version 2.38 of otfinfo is required for the script.

otftotfm takes a single set of options as an argument and also a single font file. To make a complete font family installation, however, requires the installation of many font files, each with several options. For instance, a typical font family may have multiple files (regular, italic, bold, etc.) and require several options (small caps, old-style figures, neither, etc.). Thus the script's main function is to automate the iteration over the many files and the many options.

The script (formerly known as otftex_install) can be fetched from here (CTAN directory). The interesting aspects of the script are:

• Each font calls otfinfo to read the font's attributes. The user has to set the three-character Berry name (supplier [1] + typeface [2]) and any desired scaling information in the script.

• It uses the LY1 (8y) encoding, as recommended by LCDF. Other encodings should be straightforward, however.

• The argument to the script is a single path. From that filename, the list of font files are generated. The setup is somewhat specific to the Adobe Type Classics package but I hope it will be generally useful. In sum, think of the argument you present to the script as being globbed (having a '*' after it) and it being expanded to generate the font files. This works in two ways:

• If the argument is a directory, all files in that directory will be used.

• If the argument is not a directory, it will be globbed to generate one or more directories, and all files in each of those directories will be used.

As an example, the Adobe Type Classics have four Minion directories: "Minion Pro", "Minion Pro Condensed", "Minion Pro Condensed Opticals", and "Minion Pro Opticals". If I want the files in all four directories to be used, I would call the script with the argument "/Volumes/ATC/Western Fonts/Minion Pro" (that glob-expands to all four directories), but if I want only the "Minion Pro" directory to be used, I call it with "/Volumes/ATC/Western Fonts/Minion Pro/".

• The script currently calls updmap and texhash upon completion, which eliminates a lot of problems with fonts not working properly upon first-time installation. Look for errors from these two calls; you may have to fix any updmap errors in particular. It is preferred to run the script NOT as root, but if necessary, you may also want to call updmap and texhash manually as root to update all LaTeX directories, not just the ones in your home directory.

Simply generating the font files is not enough, however. Two additional ingredients are necessary for LaTeX to properly recognize the fonts. I place all of these in a local texmf directory "tex/latex/localfonts/", although this is settable in the script. These files are automatically generated and installed by the script, assuming the directory is writeable by the script.

# .fd Required Files

The first is a "fd" font description file that maps font properties to fontnames (documented in the LaTeX2e Font Selection Guide, also in Chapter 5 of Making TeX Work). One .fd file is required per font family; currently the options that generate font families are 'onum' (old-style numbers), 'lnum' (lining figures), 'swsh' (swashes), 'sinf' (inferior figures), 'sups' (superior figures), and 'pnum' (proportional figures), each of which will generate a separate font family. Assuming the LY1 encoding is used, files for old-style and lining figures are named ly1PPPx.fd and ly1PPPj.fd, where PPP is the Berry prefix, "x" indicates expert fonts but no old-style figures, and "j" indicates old-style figures. (Swashes are 'w', superior figures are '1', inferior figures are '0', and proportional figures are '2'.) The example files (note these use long filenames, not Berry filenames):

• Adobe Caslon Pro: ly1pacx.fd (annotated version) and ly1pacj.fd.

• Adobe Minion Pro: ly1pmnx.fd (featuring opticals—multiple font files for each font shape, with the appropriate font file chosen depending on the size of the output; note this .fd file is very similar to the annotated one, except for each FontShape, we specify four files at different sizes.)

# .sty Required Files

The second is a ".sty" style file that declares the font family for use in a LaTeX document. The style file has two options: "oldstyle" and "lining" (that redefine the "rm" font to the new font family with old-style or lining figures, respectively). The default is oldstyle.

All of these style files use the common style file nfssext.sty from Philipp Lehman's fontinst package. You should get this file directly from CTAN in the file "figuide-examples.tar.gz" (direct link). This file defines the commands "\textln" and "\textos" (lining style and old-style figures), which are used in the same way as the similar LaTeX commands \texttt or \textit or \textrm.

Sample use:

\usepackage[oldstyle]{minion}           % minion is now \textrm with oldstyle
(or)
...
1234 \textln{5678}                      % 1234 is oldstyle, 5678 is lining

or
\usepackage[lining,scaled=1.1]{minion}  % minion is now \textrm with lining
% figures, scaled 1.1x bigger than usual
1234 \textos{5678}                      % 1234 is lining, 5678 is oldstyle



# Tested typefaces

All of these have been tested and work well.

• Minion Pro
• Garamond Pro
• Caslon Pro
• Jenson Pro
• Utopia Std
• Warnock Pro
• Kepler Std (thanks to Thomas Phinney)
• Prestige Elite Std
• Arno Pro
• FontFont (thanks to Jeff Sinclair)
• Scala Sans Pro
• Nexus Sans Pro
• ITC (thanks to Allan Haley)
• ITC Berkeley Oldstyle Std
• ITC Legacy Sans
• ITC Legacy Serif

# Notes/Questions/Issues

• The collective wisdom of tex-fonts indicates there aren't really any compelling reason to use Berry fontnames over the long (vendor-supplied) names, so the script only supports long names at this point. Because of the structure of nfssext, the font families internally within .fd files use three-letter Berry names (like "pmn" for Adobe Minion). Fortunately this is not visible to the end-user.

• In general OpenType fonts support, and otftotfm also supports, a whole bunch of cool options that aren't supported in my script. (Examples: alternate character forms, discretionary ligatures, ordinals, etc.) Some features are supported poorly or not at all in LaTeX. Marc Penninga's fontools appears to support more features than I do, though fontools does not support scaling. I'd be happy to add more features to this script, and I've tried to write it such that doing so would be simple.

# Acknowledgements

Thomas Phinney (Adobe), Geraldine Wade and Michael Duggan (Microsoft), Jeff Sinclair (FontFont), and Allan Haley (Monotype) provided fonts for testing. Thanks a ton to them—I am eager and willing to test fonts from other foundries!

This package would not be possible without the superb LCDF Typetools and the excellent and prompt support of their author Eddie Kohler.

Many thanks to Andreas Bachofen, Karl Berry, Ingo Beyritz, Thierry Bouche, Peter Dyballa, Eddie Kohler, Philipp Lehman, Ren Ng, Dario Teixeira, and Nicolas Vaughan for helpful comments, suggestions, and testing.

# Changelog

• 2 January 2007. v1.0.3 released. Fixes endpoints of optical sizes, which were one decipoint off, because TeX uses a different convention for representing endpoints than OpenType. Thanks to Ingo Beyritz for finding this error. Also added support for proportional figures.

• 11 December 2006. v1.0.2 released. Uses 'preferred' family/subfamily as appropriate (now available in otfinfo 2.48). Thin now is synonym for 'ultra light'. Handles subfamily text in CamelCase. Changes made to work with FontFont Scala Sans and Nexus Sans.

• 19 November 2006. v1.0.1 released. Supports font filenames with spaces in them, vendors whose URLs don't end in .com, and adds 'thin' as width synonym for 'narrow'. (Motivated by support of Yanone Kaffeesatz, thanks to Axel Becker for the suggestion.)

• 1 November 2006. Renamed to otfinst, code cleanup and refactoring, released to CTAN as v1.0.0.

• 29 May 2006: v0.32 released. Supports superior and inferior figures. Internally uses weight/width/variant for classification instead of shape/series.

• 10 May 2006: v0.31 released. Supports swashes.

• 9 May 2006: v0.3 released. Pretty much a complete rewrite; now uses otfinfo (requiring otfinfo v2.38 or greater) to get font attributes. Should be easier to maintain. The user-changeable parts of the script are now simpler, but there's no substantial user-visible changes though. (Small changes: On the command line the user can now specify files from different fonts and they will be properly handled; small-cap italic fonts now generate properly, though LaTeX is not well suited for actually calling them; Berry-compliant filenames are no longer supported, though the Berry family name is still used for compatibility with nfssext.)

• 18 April 2006: v0.24 released. Properly handles 'scaled' option now (working options are \usepackage[scaled]{fontname} and \usepackage[scaled=0.42]{fontname}); also explicitly sets lining/old-style in font commands, which fixes a problem with lining figures and small caps (thanks to Ren Ng).

• 4 February 2006: v0.22 released. Handles 'scaling' option now (thanks to Dario Teixeira for the suggestion) as well as a few additional font options (light, semicondensed/expanded, black). Now released under BSD license.

• 28 June 2005: v0.21 released. ly1ppp renamed to ly1pppx for expert fonts; also should handle new-font-family options better (even though we don't have any).

• 5 June 2005: v0.2 released. Adds automatic generation of .fd and .sty files. Now handles opticals as well.

• April 2005: v0.1 released. Iterates over features for set of font files.

John Owens | Last updated .