[OS X TeX] font install July 6

Bruno Voisin bvoisin at mac.com
Sat Jul 9 15:04:36 CEST 2005


I hadn't followed this thread closely. After asking for the font  
files off-list last night to Charles Pugh (the original poster), and  
a bit of experimentation, here's a solution, not that far actually  
from the one suggested by Peter Dyballa.

The large picture: you can't avoid reading the docs. Font  
installation is an intricate aspect of TeX, and there is no  
straightforward solution working for any font (apart from XeTeX --  
see below). The important documents here are:

- Philip Lehman's Font Installation Guide at /Library/teTeX/share/ 

- The talk "Surviving the TEX font encoding mess" at /Library/teTeX/ 

- The fontinst manual at /Library/teTeX/share/texmf.tetex/doc/ 

- The LaTeX Font Guide at /Library/teTeX/share/texmf.tetex/doc/latex/ 

- The dvips manual at /Library/teTeX/share/texmf.tetex/doc/programs/ 

Regarding "my" tutorial, I am very well aware it is outdated (it was  
written before Panther came out), contains misprints and could be  
made better (more pedagogical). But I'm not willing to update it.  
When writing it in a couple of sleepless nights two years ago, I made  
it clear I couldn't maintain it afterwards, due to lack of time/ 
competence. My aim then was to provide a starting point, for a  
community effort run by this list; unfortunately it didn't catch up.  
If people are willing to correct/modify/add information, please  
contact Bob Kerstetter, the current maintainer. Wiki might also be a  
solution, but again the tutorial is no longer "mine" and such things  
are not up to me to decide. There's also a danger of eventually  
replicating the Font Installation Guide, making it simply Mac-specific.

Back on topic, here's a list of possible steps.

Step 1: Inspecting the font

The font comes out as a Classic LWFN printer font file Csc and an AFM  
file Csc.afm. Put these, say, on the Desktop in a folder FontInstall.  
Then open Terminal, move to this folder:

     cd Desktop/FontInstall

convert the LWFN file to PFB format:

     t1unmac -r Csc/rsrc Csc.pfb

and open the PFB file in FontForge, by first launching FontForge:

     open-x11 FontForge

then selecting the PFB file. You'll get a table displaying all the  
glyphs in the font.

The font Csc turns out to be a symbol font, containing cursive  
letters and numerals with a glyph coverage similar to the Euler  
Fraktur font (see p. 31 of /Library/teTeX/share/texmf.tetex/doc/fonts/ 
amsfonts/amsfndoc.dvi). Hence the procedure is different from the one  
in the tutorial: it's actually simpler, there's no need to reencode  
the font; in TeX jargon, we'll use Csc as a raw font. This situation  
is described in section IV.4, "Installing symbol fonts", of the Font  
Installation Guide and we'll follow the procedure there closely.

Because of Csc being a symbol font, we'll choose the name zcscr (this  
renaming is absolutely unnecessary for the font to be used with TeX,  
it's just used here to make things as "clean" as possible). "z"  
because the font is bizarre, "csc" because that's its original name,  
and "r" because that's its regular shape (actually the only one  
available). See for example slides 15--16 of the Survival Guide above.

Step 2: Preparing the font

Rename the font files accordingly:

     cp Csc.pfb zcscr.pfb
     cp Csc.afm zcscr.afm

Two routes are now possible for the next step, depending of whether  
you're more comfortable with the syntax of fontinst, or with the  
syntax of LaTeX's font definition .fd files and dvips map .map files.

Step 3 (the fontinst route): Creating the font support files

This route makes use of the intricate fontinst syntax. You can either  
take it simply as an adaptation of the example in section IV.4 of the  
Font Installation Guide, and use it without wondering exactly what it  
does; or look at section II, "Installing TeX fonts with fontinst", of  
the Survival Guide, especially slides 32--35.

First, write a driver file, zcsc-drv1.tex say, containing:

     \input fontinst.sty
     \installrawfont{zcscr}{zcscr}{txtfdmns,zcscr mtxasetx}{U}{zcsc} 

and process it with plain TeX. This will create a number of files:

- A fontinst metrics file zcscr.mtx, that won't be used.

- A property list file zcscr.pl, to be processed at once by pltotf to  
create a TeX font metrics file zcscr.tfm, by typing in Terminal:

     pltotf zcscr.pl

- A LaTeX font definition file uzcsc.fd, ready for use.

- A records files zcsc-rec.tex, to be used for producing a dvips map  

Secondly, write another driver file, zcsc-drv2.tex say, containing:

     \input finstmsc.sty
     \input zcsc-rec.tex

and process it with plain TeX. This will use the records file to  
produce the map file zcsc.map.

At the end of this process you've got the three required types of  
information: TeX font metrics .tfm file, dvips .map file, LaTeX font  
definition .fd file.

Step 3 (the afm2tfm route): Creating the font support files

This route uses the afm2tfm syntax, described in section 6.3,  
"Invoking Afm2tfm", of the dvips manual; the dvips map file syntax,  
described in section 6.4, "`psfonts.map': PostScript font catalog",  
of the same manual; and the LaTeX font definition file syntax,  
described in section 4, "Font installation", of the LaTeX Font Guide.

Use afm2tfm to produce the metrics file zcscr.tfm:

     afm2tfm zcscr.afm

Then write yourself the font definition file uzcsc.fd, containing:

     \ProvidesFile{uzcsc.fd}[2005/07/09 Font definitions for the Csc  
PostScript font]
     \DeclareFontShape{U}{zcsc}{m}{n}{<-> zcscr}{}

and the dvips map file zcsc.map containing:

     zcscr Csc <zcscr.pfb

Not that difficult!

Step 4: Installing the files

Now move all these files to the appropriate places:

- zcscr.pfb inside ~/Library/texmf/fonts/type1/berkeley/csc/

- zcscr.afm inside ~/Library/texmf/fonts/afm/berkeley/csc/

- zcscr.tfm inside ~/Library/texmf/fonts/tfm/berkeley/csc/

- zcsc.map inside ~/Library/texmf/fonts/map/dvips/berkeley/

- uzcsc.fd inside ~/Library/texmf/tex/latex/csc/

("berkeley" because, if I understood correctly, this is a UC Berkeley  
logo header font), and run updmap to make dvips and pdfTeX aware of  
the new font:

     sudo updmap --enable Map zcsc.map

You may also put the files inside /Library/teTeX/share/texmf.local/  
instead of ~/Library/texmf/, so that the font will be available to  
all account owners on your Mac instead of being only available in  
your account. In that case, you'll be asked for an admin password  
when moving the files, you may need to use the command mkdir in  
Terminal for creating folders, and you'll need to run, before updmap:

     sudo texhash

To test your installation is correct, you can use one of the  
available font test files. For example, copy /Library/teTeX/share/ 
texmf.tetex/tex/plain/base/testfont.tex to your FontInstall folder,  
then process it with plain TeX and type at the prompt (each line  
followed by <Return>):


Same with /Library/teTeX/share/texmf.tetex/tex/latex/base/ 
nfssfont.tex, to be processed with LaTeX: type at the prompt:


If everything's correct, you should obtain the same type of font  
table as in FontForge. Then there's only one thing left: write a  
LaTeX package, defining commands for selecting the font.

Step 5: Creating a LaTeX package for the font

Based on the info in sections 2, "Text fonts", and 3, "Math fonts",  
of the LaTeX Font Guide, write a file csc.sty containing:

     \ProvidesPackage{csc}[2005/07/09 LaTeX support for the Csc  
PostScript font]

This defines three commands for using the font in any LaTeX document:

- A declaration \csc, to be used in text mode in the form : {\csc blah}.

- A text font command \textcsc, to be used in text mode in the form  

- A math font command \mathcsc, to be used in math mode in the form  

Next move csc.sty  to ~/Library/texmf/tex/latex/csc/ (or to /Library/ 
teTeX/share/texmf.local/tex/latex/csc/, but then run "sudo texhash"  
afterwards). You're done!

You can test everything works by creating and typesetting a LaTeX  
file such as:



     AAA {\csc AAA}

     BBB \textcsc{BBB}

     CCC $\mathcsc{CCC}$


Now, all the above is based on "traditional" LaTeX mechanisms. On the  
Mac we've also got XeTeX, which allows direct use of OS X fonts in  
TeX. Meaning that, of all the above, only the steps corresponding to  
the creation of the LaTeX .fd and .sty files are necessary: the  
creation of the .pfb, .tfm and .map files is unnecessary. For  
example, with the font itself (font suitcase and printer file)  
installed in your Classic font folder, and with XeTeX installed, you  
simply need, for using the font Csc, to write in the preamble of a  
LaTeX document:

     \DeclareFontShape{U}{Csc}{m}{n}{<-> Csc}{}

and then in the document itself:

     {\csc AAA}

With the fontspec package installed this is even simpler, in that you  
only need to put in the preamble:


and in the document itself:

      {\fontspec{Csc} AAA}

That said, this comes at a price, and XeTeX isn't supported by a  
number of LaTeX packages which only know dvips and pdfTeX. XeTeX  
lives at <http://scripts.sil.org/xetex/> and has a dedicated mailing  
list <http://tug.org/mailman/listinfo/xetex>.

Hope this helps,

Bruno Voisin
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the Macostex-archives mailing list