LaTeX is the best typesetting system in the world and OpenType (.otf)
fonts are some of the best in the world, but installing fonts in
general is difficult in LaTeX. It eluded me for several years but
now I've succeeded. (For the record, I use PDFeLaTeX in the
MikTeX
distribution with TeXnicCenter, but this should not make much
difference.) Here's how:
1. Installing the fonts
I'll use a simple example, Adobe Caslon Pro, which comes in three
weights divided into six files:
ACaslonPro-Bold.otf
ACaslonPro-BoldItalic.otf
ACaslonPro-Italic.otf
ACaslonPro-Regular.otf
ACaslonPro-Semibold.otf
ACaslonPro-SemiboldItalic.otf
The tool to use for the installation is Eddie Kohler's amazing
otftotfm, available here.
It's common advice to rename the files according to the Berry naming
scheme. This is useless---it's a lot of hard work to make
everything more confusing. The vendors' names might not be
perfectly consistent, but they're at least as good as Berry and they
make sense. It's best to leave them alone. As for
encodings, LY1 seems to be best suited for OpenType.
Open Type and LaTeX have many, many features that, in my opinion, boil
down into 4x12+1=49 different shapes (two axes plus ornaments; we'll
use the following codes later):
Major axis:
Roman (rm, r) - normal, upright text.
Italic (it, i) - slanted, stylized text used for emphasis.
Slanted (sl, s) - Roman letter forms slanted to match
the Italics. Some people hate them. I found a very
specialized use for them once: in my Ph.D. thesis, I set the names of
object-oriented classes in slanted Roman, leaving normal text for
the names of the concepts they represented.
UprightItalic (ui, u) - Italic letter forms slanted backwards to
match the Romans. A typographical freakshow?
Maybe, but maybe someone will find something other than a display use
for them.
Minor axis:
regular (rg) - the usual, normal shape.
all-caps (ac) - doesn't change lowercase to uppercase (for the
same reason that small-caps doesn't alter the capitals---because you
might want to use the two together), it alters the spacing around caps
and alters the punctuation to harmonize with capitals.
small-caps (sc) - capital letter forms made to harmonize with
lowercase. Elegant, often used for abbreviations and headers.
swashes (sw) - informal, calligraphic forms used for display.
inferior figures (in) - small, low numbers---now you can speak
elegantly about U235.
superior figures (superscripts) (su) - useful for footnote marks
and ordinal numbers.
Tabular figures are monowidth so that they line up in tables.
Proportional figures have better spacing. Old-style figures look
better in text. Lining figures (all the same height, so they line
up in that sense) are better, e.g., with all-caps headlines or for some
special meaning (I use them for quantities). They look like two more
axes, but they aren't, since the first four shapes must contain one
default version of them.
That's the scheme we'll impose on the many OpenType options otftotfm
can extract from the source files (you can read the otftotfm docs to
find out more about these). Here are the switches that go with
the above shapes:
rm:
it:
sl: -S amt, where amt=the tangent of slant of the Italics
ui: -S -amt
rg: -fpnum -fonum
ac: -fcpsp -fcase -fpnum -flnum
sc: -fsmcp
sw: -fswsh
in: -fsinf
su: -fsups -fordn
nu: -fnumr
de: -fdnom
po: -fpnum -fonum
pl: -fpnum -flnum
to: -tnumf -fonum
tl: -tnumf -flnum
ornaments: -fornm
You can find out which features are available by examining the source
files with otfinfo -f (also by Eddie Kohler), but the above
should work fine. This is the stage where (by using switches) you
select the default style of figures to use with the shapes rg, ac, sc
and sw. I use proportional lining figures with all-caps and
swashes (since they're usually display) and proportional old-styles
with regulars and small-caps, since they're usually text (actually, I
leave the defaults for sc and sw to the discretion of the font
designer, since sc and sw figures are conceivable); tabulars aren't
useful outside of special situations like tables and lists.
Here are all the otfmtotfm commands
needed to install the three weights with the 49 options. I used other,
standard switches, e.g., to enable ligatures and kerning. The -a switch
should cause otftotfm to place everything where it belongs in
your directory tree. The alt. selector character is used to select
alternate stylistic forms
of the same character if they exist, e.g., a calligraphic variant or an
historical ligature. In your text, you might type c*t and get the old
ligature, for example. I sacrificed the registered trademark character
for this (it won't be usable otherwise now); this is easily changed.
(Apparently, not all
alternate forms can fit in the converted font---I notice some on the
factory specimen sheet that I can't access.) To measure the slant to
match the Slanted Romans to the Italics (and its opposite, to unslant
the Italics), I measured the run/rise of the left edge of the left
Italic bracket. This worked fairly well, but apparently the
lowercase
Italics slant more than this, and so don't appear perfectly upright in
their UprightItalic versions. If Uprights are very important to you,
you might want to correct this---otftotfm has some options that might
help.
2. Preparing the font description (.fd) file
The font description file is a LaTeX file that sits in your local texmf
directory (somewhere like C:\localtexmf\tex\latex\lcdftools) and
relates the font files you just installed to low-level selection
commands like \fontshape{}\selectfont. My naming scheme is simple---I
use trigraphs constructed from the shape codes above. The first
letter indicates the major axis and the remaining two indicate the
minor axis. I did something similar to separate the font series
into two axes, weight and width. So, my series are indicated by
four letters, the first two indicating weight and the second two
indicating width. So far, I've only defined the following; weight:
light (lt)
medium (md) (probably "book")
semi-bold (sb)
bold (bd)
black (bl)
and width:
condensed (cd)
half-condensed (hc) (the odd name avoids a collision with sc)
normal-width (nw)
semi-extended (sx)
extended (ex)
It shouldn't be difficult to add more as needed.
Here is my example .fd file,
LY1ACaslonPro.fd (note the name of the encoding in the filename).Notice that some of the codes
point to files you might not expect. This is because the source
font didn't contain all of the 48 possible variations, so I made
substitutions. For example: Slanted small-caps are substituted
for Italic small-caps; UprightItalic swashes are substituted for Roman
swashes.
3. Without which, nothing.
Buried somewhere in the documentation, in a file not referred to
anywhere that I know of is the following gem: after preparing the
above you must not only update TeX's filename database, but also make
new map files. Something like the following:
cd C:\localtexmf
initexmf -u
initexmf --mkmaps
initexmf -u
cd C:\texmf
initexmf -u
initexmf --mkmaps
initexmf -u
You must also do this after any change you make to the above steps.
4. Setting up a new NFSS
Now you'll want to use those OpenType features in LaTeX with a new new
font selection scheme. I've written a package
to do this (unfortunately named "myfss"). Since I don't know plain TeX
at all, the programming is strictly at the caveman level and it could
surely be refined, but it all works.
The main benefit of myfss is that it provides middle- and high-level
selection commands for the separated series and shape axes. The
middle-level commands, like \bdexseries, \textbdex{} (bold extended) or
\iscshape, \textisc{} (Italic small-caps) select specific series
(weight/width combinations) or specific shapes with the four- or
three-letter codes described above. The high-level commands, like
\ltweight, \textlt{} (light weight), \exwidth \textex{} (extended
width), \uishape, \textui{} (UprightItalics), \toshape, \textto{}
(tabular old-style) select weights, widths and the two shape axes
independently. For example, in a book on cinema, one might find a
header set: "\scshape Fellini's \textit{Roma}". All of this is
done without breaking the old, familiar selection commands. There
is a selection for ornaments, but there is also a more convenient
command, \ornament{<ornament number>}{<size>}{<baseline
skip>}.
Several other niceties are provided:
footnotemarks are set up to use superior figures.
vulgar fractions (horizontal with small numbers) using the nu and
de shapes.
compound vulgar fractions.
nut (aka case) fractions (vertical with small numbers) (The
italic versions of these are a little flawed---maybe someone can
improve them?).
compound nut fractions.
shilling fractions (horizontal with large numbers) available in
either old-style or lining (compound shilling fractions look awful).
time signatures.
commands for setting quantities and ranges of quantities (in
proportional lining figures, so an all-caps en-dash is appropriate).
Obviously, some of these come from my idiosyncrasies, but you can
modify the package to suit yourself. Also, this opens the
possibility of setting "\scshape Fellini's \textit{\cvfrac{8}{1}{2}}".
5. Making a package for the particular font.
Here's my example of caslon.sty. It does
three things:
It sets up caslon as the default rm font. You might want to
make this optional.
It maps the \char codes of the ornaments to the ornament numbers
used by the myfss \ornament command.
It fixes a few broken commands to access special characters.
The data for 2 and 3 were obtained during the next step.
6. Making a little specimen sheet.
A little document like this is
great to use for testing. I used it to search for ornament
numbers, missing characters and alternate forms. It includes a
handy reference for LaTeX commands to access special characters.
Future extensions:
To set other scripts (Greek and Cyrillic OpenType fonts are not
uncommon), a different encoding will probably be necessary, and the
otfinfo -s command will probably be useful.
To use optical fonts (different source files for different font
sizes) should be easy---only a small modification of the
\DeclareFontShape commands in the .fd file is necessary; see the docs
for it.
Yes, it would be nice to have a script that does all this
automatically, but using copy, paste, find and replace, it's not too
difficult---it's a pushbutton world. Enjoy your fonts! I
have a lot to learn about installing fonts;
comments and questions are welcome. I'd be especially happy if
anyone refined my code for the myfss. o d r a d e k 5 \textat g m
a i l.