the simple guide to type 1 fonts in latex
TRANSCRIPT
-
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
1/14
The Simple Guide to Type Fonts in LTEX
Version .
Matthew Amster-Burton ([email protected])
April ,
Contents
Important Note
Introduction
Type fonts: backgroundandglossary
. Other font formats
. Potential pitfalls
Is this document right for you?
Maintaining a l o c a l t e x m f directory
Prerequisites
The Process
. Make sure you have all the pieces
. Rename the font files to the Karl Berry standard
. Create a f o n t i n s t script
. Run the script through TEX
. Compile the * . p l and * . v p l files
. Delete the leftover junk
. Move the files to the proper directories. Create a LTEX package
. Create a map file for dvips and pdfTEX
. Rebuild the hash tables
. Test out your new font
mailto:[email protected]:[email protected] -
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
2/14
Expert sets
. Text or lining figures?. The \ l a t i n f a m i l y command
. Create two LTEX packages
. Create a map file for dvips and pdfTEX
. Switching between the two fonts
A Helpful scripts
B Acknowledgments
C Copyright
-
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
3/14
Important Note
This document has been superseded by Philipp Lehmans The Font Installation
Guide: Using Postscript Fonts to Their Full Potential with LTEX, available on the
web. Lehmans document covers everything this one does and more, and its better
organized.
The source for the document youre reading is available. Heres the main file
and the style file. Please feel free to modify and redistribute this file; I request that
you keep my name on it.
Introduction
It comes up onc o m p . t e x t . t e x
almost every day: How do I install my Type fonts in TEX/LTEX? How do I use expert fonts? How do I specify oldstyle figures
instead of lining figures? Generally these questions get answered with the usual
amount of grumbling, but the answers tend to vary in quality and everyone has
their own advice.
Most people neither need nor want to delve into the gory details of f o n t i n s t
or TEXs virtual font mechanismthey just want to get their font installed and
working with a minimum of fuss. As far as I know, there is no document on this
subject that is both clear and complete. This is an attempt to remedy that situation.
The process described below will not solve every font problem you come across. Its
designed for the simple, everyday case that clogs the newsgroup. Lets begin.
Type fonts: background and glossary
The Type format was developed by Adobe Systems. Adobe remains the largest
supplier of Type fonts, but there are many other quality type foundries including
Agfa-Monotype, , and Hoefler. Type is an outline font format, which means
that fonts in this format can be scaled to any size. Fonts can be broken down into
two general categories: body type and display type. Body type is suitable for type-
setting long stretches of text. Display type is suitable only for titles, ad copy, and the
like. Most body typefaces work perfectly well in a display capacity, but the reverse
is untrue (see figure ??). This document works equally well for installing body and
display types.
Nearly all of the popular typefaces you see in regular use are available in Type
format. Before you use this document to install a new font, make sure you dont
already have it installed: most TEX installations already include the basic Postscript
http://www.ctan.org/tex-archive/info/Type1fonts/fontinstallationguide.pdfhttp://www.ctan.org/tex-archive/info/Type1fonts/fontinstallationguide.pdfhttp://www.mamster.net/tex/fontfaq.texhttp://www.mamster.net/tex/fontfaq.styhttp://www.mamster.net/tex/fontfaq.styhttp://www.mamster.net/tex/fontfaq.texhttp://www.ctan.org/tex-archive/info/Type1fonts/fontinstallationguide.pdfhttp://www.ctan.org/tex-archive/info/Type1fonts/fontinstallationguide.pdf -
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
4/14
fonts Times, Palatino, and Helvetica. See the documentation for .
Not all font sets contain the same number of characters. All will come with cap-ital and lowercase letters (except for certain display types such as Trajan that have
only capital letters) and a set of numerals, punctuation marks, and certain accented
characters and math symbols. In addition to the above, fonts may also include an
expert set, which usually consists of small caps, extra ligatures, text figures (low-
ercase numbers that integrate better with text), and some extra punctuation and
superscript/subscript characters. A font with its expert set is often referred to as an
expert font. Note that the expert set by itself is as useless as Dellas combs in The
Gift of the Magi. This document explains how to install expert fonts.
Instead of an expert set, a font may offer a / variant, which contains cap-
itals and small caps, text figures, and punctuation, but no extra ligatures or super-
and subscripts. Unlike an expert set, a
/
font can be used by itself to settext in C & S C. This document does not explain how to in-
stall / fonts; however, if you dont care about text figures (I would argue that
you should, but its up to you) you may follow the instructions in this document
for non-expert fonts and will end up with a usable result. For an illustration of the
difference between an expert font and a / font, see figure .
A Type font will come with a set of files for each variant (explain this). De-
pending on the vendor and the package you buy, each variant may be represented
by between two and four files as follows:
files contain the actual font outlines. These are always required and always
supplied.
files contain font metrics describing the spacing and other characteristics
of the letterforms. For example, an italic fonts file will tell you the angle of the
italics slant. If you feel like modifying the kerning tables of a font, start here.
files are text and can be edited by hand.
files are a neutered binary-format version of files for use on the
Windows platform. They are required for installing fonts under Windows, but
TEXdoesnt need them at all. If you have an Adobe-supplied font with files
but no s, you can usually download the s from Adobes FTP site. There is a
program for converting s to s, but Ive never gotten it to work right. I have
had some luck generating files from s using the commercial font editor documentation: h t t p : / / t e x . l o r i a . f r / g e n e r a l / n e w / f n t g u i d e . h t m l
http://tex.loria.fr/general/new/fntguide.html -
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
5/14
FontLab and the free editor PfaEdit, but the resulting usually requires some
hand-editing.
files are text-format files that allow Windows to regenerate a file based
on the . As you would expect, these files are also ignored by TEX.
. Other font formats
TrueType is a format developed by Microsoft as a competitor to Type . There is a
web page explaining how to use these fonts with TEX.
OpenType is the newest format on the block. Jointly developed by Microsoft
and Adobe, OpenType fonts can contain up to , characters and comply with
the Unicode standard for international text. Unfortunately, TEX itself is limited to
characters per font, and the OpenType format is incompatible with most pop-ular versions of TEX.
Someone would do well to write a program that converts an
OpenType font to a pair of Type fonts, regular and expert.
MultipleMaster fonts are a Type variation that allow to you interpolate along
various axes such as weight, optical size, or width, meaning, for example, that you
can make a font exactly as bold or light as you like. They never caught on, probably
because they are tricky to use, and Adobe (who was the main vendor of fonts) is
replacing them with OpenType fonts as fast as they can. Some people have come up
with clever ways to generate Multiple Master () fonts on the fly, but generally,
to use fonts, you have to generate instances and install them like regular Type
fonts. There is a free utility called m m i n s t a n c e to handle this for you, but it
requires files, which are hard to come by. Without the files, youllhave to use a commercial utility such as FontLab.
. Potential pitfalls
All of the expert sets provided by Adobe should work fine with this document. Ex-
pert sets from other vendors, however, may not, because they dont sort the charac-
ters in the same way. For example, the procedure outlined in this will not work
with the expert sets from or Carter & Cone. These fonts can be made to work
FontLab: h t t p : / / w w w . f o n t l a b . c o m / PfaEdit:
h t t p : / / p f a e d i t . s f . n e t /
Using TrueType fonts with TE
X and pdfTE
X:h t t p : / / w w w . r a d a m i r . c o m / t e x / t t f - t e x . h t m
This is not exactly true: A few OpenType fonts are internally stored in TrueType font. One of
these, the Palatino Linotype font that comes with Windows XP and Windows , has been adapted
for use with TEX.m m i n s t a n c e
:h t t p : / / w w w . l c d f . o r g / ~ e d d i e t w o / t y p e /
http://www.lcdf.org/~eddietwo/type/http://www.radamir.com/tex/ttf-tex.htmhttp://pfaedit.sf.net/http://www.fontlab.com/ -
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
6/14
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890
f1357
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890
f1357
Figure : / vs expert fonts. Left: From top, Sabon Regular, Sabon , Sabon
Regular Italic, Sabon ItalicOsF. Right: From top, Minion Regular, Minion Regular
Expert, Minion Italic, Minion Italic Expert. Note that expert sets do not contain
capital letters.
with TEX, but it requires some under-the-hood work with f o n t i n s t beyond the
scope of this document.
Is this document right for you?
This is the right document for you if you find yourself in the following situation:
You have some Type fonts you want to install.
You may have expert fonts available, in which case youd like to get small caps,
extra ligatures, and text figures working properly. Work through section but
see section for the additional steps needed to install an expert set.
You do not have / fonts, which are more complicated to install and
beyond the scope of this document. (Ill be covering them in a future .)
There are prepackaged metrics for some such fonts (including the popular
Adobe releases of New Baskerville, Times Ten, and Stempel Garamond)
available from font maven Walter Schmidt.
Maintaining a l o c a l t e x m f directory
No matter what TEX system you use, maintain a local directory (either system-wide on a single-user system such as Windows, or under your home directory on
a multiuser Unix system). Installing fonts means dropping files all over your hard
Walter Schmidts font page: h t t p : / / h o m e . v r - w e b . d e / w a s / f o n t s
http://home.vr-web.de/was/fonts -
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
7/14
drive, and if you dont have a way of keep track of what files youve added to your
TEX distribution, you are going to cry later. I will refer to the local directory asl o c a l t e x m f ; call yours whatever you want.
has some good documentation on maintaining a local directory. The
same document includes some incomplete font installation advice and is not a re-
placement for this document.
Prerequisites
Youll need the following:
A TEX system based on TEX. This includes most popular free and sharewaredistributions, including MiKTEX for Windows, OzTEX for Mac, and teTEX
for Unix. It does not include Y&Y TEX, which uses its own virtual font sys-
tem but makes Type fonts easy to install. If youre using Y&Y, read your
documentation rather than this document.
A recent version of f o n t i n s t , . or newer. Available from the Comprehen-
sive TEX Archive Network ().
A map table based on the Karl Berry font naming scheme. If you have the
f o n t n a m e package installed (most distributions install it by default), you
should find a directory of map files. Under a -compliant system, its
t e x m f / f o n t n a m e
.
The Process
Throughout this procedure, well work with an example font. Ill use Adobe Min-
ion, which is the font used to set this document (in form, at least). When
appropriate, Ill discuss how to install the expert set.
. Make sure you have all the pieces
Youll need the and files for the font family you wish to install. Dont try to
install more than one font family at a time. If you dont have the files, you canManaging a one-person TEX system: h t t p : / / w w w . c t a n . o r g / i n s t a l l a t i o n a d v i c e / f o n t i n s t
:h t t p : / / w w w . t u g . o r g / a p p l i c a t i o n s / f o n t i n s t /
: h t t p : / / w w w . c t a n . o r g / Berry map files: h t t p : / / w w w . t u g . o r g / f o n t n a m e / f o n t n a m e _ 4 . h t m l
http://www.tug.org/fontname/fontname_4.htmlhttp://www.ctan.org/http://www.tug.org/applications/fontinst/http://www.ctan.org/installationadvice/ -
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
8/14
download them from Adobes site. This site tends to go down sporadically; if
you have trouble, keep trying, and when you get through, download all the syou think youll need. You may also have and files; these have nothing to
do with TEX and may be deleted. Put all your font files in a single scratch directory.
. Rename the font files to the Karl Berry standard
If you understand the naming rules, great. If you dont, who cares? Just follow the
map file. For example, heres a line from a d o b e . m a p :
p m n r 8 a M i n i o n - R e g u l a r A 1 4 3 m o r g _ _ _ _
This tells you that the font Minion-Regular is known to Adobe as m o r g _ _ _ _
(that is, m o r g _ _ _ _ . p f b and m o r g _ _ _ _ . a f m ) and in the Berry scheme as p m n r 8 a .
So, under :
C : > r e n m o r g _ _ _ _ . * p m n r 8 a . *
And under bash:
% f o r f i l e n a m e i n " $ @ " ; d o . . .
Theres another useful piece of information in the line from the map file. The
number, , tells you in what directory youll find the file on the Adobe
site.
Now, if you are an old-school batch file hacker, you are probably thinking to
yourself, Why in the world would I do this manually when all the information is
right there in the map file? You are a person after my own heart. Ive created a Perlscript to rename the files automatically. Its included at the end of this document or
you can download it.
. Create a f o n t i n s t script
The f o n t i n s t package has a command that takes care of any simple font installa-
tion task: \ l a t i n f a m i l y . Create a file (I tend to call mine f i . t e x ) containing the
following:
\ i n p u t f o n t i n s t . s t y
\ l a t i n f a m i l y { p m n } { }
\ b y e
p m n is the Berry shorthand for Adobe Minion; replace it with the abbreviation
for your font.
Adobe files:f t p : / / f t p . a d o b e . c o m / p u b / a d o b e / t y p e / w i n / a l l / a f m f i l e s
http://www.mamster.net/tex/berry.plftp://ftp.adobe.com/pub/adobe/type/win/all/afmfileshttp://www.mamster.net/tex/berry.pl -
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
9/14
. Run the script through TEX
Nothing tricky here:
% t e x f i
When f o n t i n s t finishes (it can take a substantial amount of time), you should
have a bunch of * . p l , * . v p l , * . m t x , and * . f d files. If you dont, something went
wrong. Look through the log (f i . l o g in our example) for errors.
. Compile the* . p l
and* . v p l
files
The * . p l files must be compiled into * . t f m files; the * . v p l files must be compiled
into * . v f files. This is done using the p l t o t f and v p t o v f utilities, which should
be included with your TEX distribution. The syntax is as follows:p l t o t f f i l e . p l f i l e . t f m
v p t o v f f i l e . v p l f i l e . v f f i l e . t f m
For some reason, the utilities included with MiKTEX require the full syntax, but
under teTEX most of the arguments are optional, making life much easier:
p l t o t f f i l e
v p t o v f f i l e
As above, you should automate this with a script.
. Delete the leftover junk
You no longer need the * . m t x , * . p l , and * . v p l files and should delete them.
. Move the files to the proper directories
Under any-compliant system (including MiKTEX and teTEX), the files go like
this:
File type Directory
* . p f b l o c a l t e x m f / f o n t s / t y p e 1 / v e n d o r / n a m e
* . a f m l o c a l t e x m f / f o n t s / a f m / v e n d o r / n a m e
* . t f m l o c a l t e x m f / f o n t s / t f m / v e n d o r / n a m e
* . v f l o c a l t e x m f / f o n t s / v f / v e n d o r / n a m e
* . f d l o c a l t e x m f / t e x / l a t e x / v e n d o r / n a m e
So, for example, p m n r 8 a . p f b (Minion Regular) would go in
l o c a l t e x m f / f o n t s / t y p e 1 / a d o b e / m i n i o n .
-
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
10/14
. Create a LATEX package
If you use LTEX, youll want to make a package to simplify the use of your new font.
You can place it in the same directory as the * . f d files. Your m i n i o n . s t y should
look like this:
\ P r o v i d e s P a c k a g e { m i n i o n }
\ r e n e w c o m m a n d { \ r m d e f a u l t } { p m n }
\ e n d i n p u t
. Create a mapfile for dvips and pdfTEX
Heres what the map file should look like for Minion (regular, italic, bold, and bold
italic):
p m n r 8 r M i n i o n - R e g u l a r " T e X B a s e 1 E n c o d i n g R e E n c o d e F o n t " < 8 r . e n c < p m n r 8 a . p f b
p m n r i 8 r M i n i o n - I t a l i c " T e X B a s e 1 E n c o d i n g R e E n c o d e F o n t " < 8 r . e n c < p m n r i 8 a . p f b
p m n b 8 r M i n i o n - B o l d " T e X B a s e 1 E n c o d i n g R e E n c o d e F o n t " < 8 r . e n c < p m n b 8 a . p f b
p m n b i 8 r M i n i o n - B o l d I t a l i c " T e X B a s e 1 E n c o d i n g R e E n c o d e F o n t " < 8 r . e n c < p m n b i 8 a . p f b
If you think Im going to explain each part of this line, youve got the wrong
. Just make the changes youd expect for your own font. All of the necessary
information can be found in the Berry map file, and you should never change the
" T e x B a s e 1 E n c o d i n g R e E n c o d e F o n t " or 8 r . e n c .
For example, say you were installing Sabon. Perusing the a d o b e . m a p file, you
find the following line:
p s b r 8 a S a b o n - R o m a n A 0 8 8 s a r _ _ _ _ _
This tells you that the short name for Sabon is p s b . The full name of the regular
variant is Sabon-Roman, and the Berry name is p s b r 8 a . Substituting an r for the a
at the end of the name gives you p s b r 8 r , the name of the virtual font file that TEX
is looking for. Now you have enough information to generate one line of the Sabon
map file ( p s b . m a p ):
p s b r 8 r S a b o n - R o m a n " T e x B a s e 1 E n c o d i n g R e E n c o d e F o n t " < 8 r . e n c < p s b r 8 a . p f b
The Minion map file should be named p m n . m a p . Your map file should be named
(three-letter font name). m a p . Place it inthe dvips c o n f i g directory. Under MiKTEX,
thats l o c a l t e x m f / d v i p s / c o n f i g . Place another copy (or better, a link) in the
pdfTEX c o n f i g directory (l o c a l t e x m f / p d f t e x / c o n f i g ) if you use pdfTEX.
-
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
11/14
Next, youll need to tell dvips and pdfTEX about the new map file. For dvips,
make a copy ofc o n f i g . p s
and drop it into your local tree. The file should al-ready have a line showing dvips where to find its existing map file (often called
p s f o n t s . m a p ). Right after that line, add the line:
p + p m n . m a p
For pdfTEX, the config file is called p d f t e x . c f g . Copy it to your local tree, and
add the following line to the end of the file:
m a p + p m n . m a p
Finally, your viewer needs to know about that map file. For MiKTEXs yap,
edit c o n f i g . m a k e p k and add:
p + p m n . m a p
Again, this can and should be automated with a script. Keep reading for details.
. Rebuild thehash tables
Now you have to tell TEX that youve moved files around, or it wont be able to find
any of your new goodies. Under MiKTEX:
C : \ > i n i t e x m f - u
C : \ > i n i t e x m f - - m k p s r e s
or use the MiKTEX Options program (figure ).
Under teTEX:
% t e x h a s h
. Test out your new font
That should do it! Try running the following document through LTEX tosee ifyour
new font is working:
\ d o c u m e n t c l a s s { a r t i c l e }
\ u s e p a c k a g e { m i n i o n } % s u b s t i t u t e t h e n a m e o f y o u r f o n t
\ b e g i n { d o c u m e n t }
H o w d o y o u l i k e m y n e w f o n t ?
\ e n d { d o c u m e n t }
-
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
12/14
Figure : Using the MikTEX Options program to rebuild TEXs hash tables
Expert sets
If you use TEX, youre probably serious about typesetting. And if youre serious
about typesetting, you should choose a font with an expert set available. An expert
set includes small caps, text figures, extra ligatures, and often other treats such as
small punctuation marks and superscript characters. Again, remember that an ex-
pert set is useless without the base font. Minion Regular Expert, for example, is
no good without Minion Regular.
You can install a font with an expert set using almost exactly the procedure
above. There are only two differences.
. Text or lining figures?
Text figures (also known as oldstyle figures, hanging figures, and in German the
delightful Medivalziffern) are the lowercase numbers used throughout this doc-
ument. Some of them have ascenders and some hang below the baseline, just like
lowercase letters. Text figures are the right choice for most documents but are not
generally used in technical writing with a lot of mathematics. So if you have an ex-
pert set available, youll want to generate two fonts: one with text figures, one with
lining figures. Its easy to switch back and forth within a single document if you
like.
. The \ l a t i n f a m i l y command
The TEX jargon for expert font with text figures is j and the jargon for expert
font with lining figures is x. Your f o n t i n s t script should look like this:
-
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
13/14
\ i n p u t f o n t i n s t . s t y
\ l a t i n f a m i l y { p m n j } { } % M i n i o n e x p e r t f a m i l y w i t h t e x t f i g u r e s
\ l a t i n f a m i l y { p m n x } { } % M i n i o n e x p e r t f a m i l y w i t h l i n i n g f i g u r e s
\ b y e
. Create two LATEX packages
Because youve created two fonts, you need two LTEX packages. For text figures:
\ P r o v i d e s P a c k a g e { m i n i o n j }
\ r e n e w c o m m a n d { \ r m d e f a u l t } { p m n j }
\ e n d i n p u t
And for lining figures:
\ P r o v i d e s P a c k a g e { m i n i o n x }
\ r e n e w c o m m a n d { \ r m d e f a u l t } { p m n x }
\ e n d i n p u t
As above, these may be placed in the same directory as the * . f d files.
. Create a map file for dvips and pdfTEX
Your map file needs to include lines telling the drivers where to find the expert
sets. Your map file should contain the following lines in addition to those explained
in section ..
p m n b 8 x M i n i o n E x p - B o l d < p m n b 8 x . p f b
p m n b i 8 x M i n i o n E x p - B o l d I t a l i c < p m n b i 8 x . p f b
p m n r 8 x M i n i o n E x p - R e g u l a r < p m n r 8 x . p f b
p m n r i 8 x M i n i o n E x p - I t a l i c < p m n r i 8 x . p f b
Note that these are a lot simpler than the lines for the non-expert parts of the font.
. Switching between the two fonts
To switch between oldstyle and lining figures, just switch fonts. For example, if
youre currently using Minion with text figures ( p m n j : ) and wish to switch to
Minion with lining figures ( p m n x : 12345) use the following command:
\ f o n t f a m i l y { p m n x } \ s e l e c t f o n t
-
8/14/2019 The Simple Guide to Type 1 Fonts in LaTeX
14/14
A Helpful scripts
Warning: These scripts are like this as a whole. There is no warranty. Addi-
tionally, the scripts are in the public domain. Change and improve them however
you like; there are plenty of missed opportunities for error checking and additional
functionality, but they work well enough for me.
Im currently working to make the script more portable, so I havent included it in
this draft. If you know of any existing scripts for renaming files to the Berry standard,
please email me.
B Acknowledgments
Thanks to Laurie Amster-Burton, Gunther Schmidl, and Gabriel Zachmann forlooking over drafts of this document, and to Don Knuth for creating the worlds
most powerful and maddeningly satisfying typesetting system.
C Copyright
The . release of this document will include LTEX source and will be licensed un-
der the Free Documentation License. This draft, however, is c Matthew
Amster-Burton and may not be modified.
mailto:[email protected]:[email protected]