Kwantus' TTF/teTeX notes

Simpler Method for Decorative and Dingbat Faces

I collected several decorative and dingbat TTFs from the 'net. The method above worked for some of them; but not all. I wanted them badly enough, and had enough curiosity about the TeX stuff, that I forged a new method.

The process, in outline, is:

  1. Use ttf2afm (part of teTeX) to create an Adobe metric (AFM) file without an encoding.
  2. Use Ghostscript to extract the default encoding.
  3. Merge the encoding into the AFM (there's no handy command to do this).1
  4. Use afm2tfm to make the TeX metric file.2
  5. Add entries to the dvips and Ghostscript mappings.

I use ttf2afm instead of ttf2pt1 because: 1. ttf2afm comes with teTeX. 2. ttf2pt1 insists on attempting to convert the outlines, which sometimes crashes.3

I use Ghostscript because: 1. The output of ttf2afm omits the encoding. (There's a switch for extracting the encodings separately, but I can't tell which is the default encoding and some TTF encoding-store formats are unknown to it.) 2. I cannot blithely impose an encoding; some TTFs have glyph names that are `strange' (Alchemy has `aries,' `fifty,' 'night,' etc.) or, worse, bogus (BlackChancery and Garton are off by one, with A named `B,' etc.). 3. Ghostscript itself chokes on some TTFs; this is a chance to find out early in the process.

I made a TCL script to process a batch of TTFs. One gotcha is that I also create the Ghostscript mapping with it, so I can't use findfont to load a font to pull its encoding. I dug up a nonstandard Ghostscript command .tryloadfont which gets around the issue.

I think the way to show how to use the script is by example. Its first argument is a name under which to group the faces, the rest are the names of TTF files. Suppose the script is named `bundle,' and za.ttf and zb.ttf are TTFs in the current directory. Issuing bundle y za.ttf zb.ttf will produce these files:

The texmf tree should be moved into the TeX data area, then texhash run. Then `y.map' has to be added to extra_modules of texmf/dvips/config/updmap. and the latter run. Finally the content of y.ps has to be added to Ghostscript's map; appending it to /usr/pkg/share/ghostscript/6.01vflib/lib/Fontmap.GS will do (if you installed Ghostscript from the 6.01 NetBSD package; you should also check that the paths in the map accurately reflect your system's texmf location). At this point the new faces should be ready for use, under the names `za' and `zb.'

As a demo, here's a bit of a title page made with Intimacy, Seperates, and Nuncio-Normal:
sample title page
The TeX code was

\centerline{\font\X zintimacy at40pt\X Manchester}
\bigskip
\centerline{\font\X zseperate at40pt\X\char100}
\bigskip
\centerline{\font\X znuncio at30pt\X A Municipal Microcosm}

TTFs tend to come with messy names. I remove underscores, downcase, and start the name with z (as close as I come to conforming to the TeX naming convention) using this csh command:

foreach i (*.[Tt][Tt][Ff])
    mv $i `echo z$i | tr A-Z a-z | tr -d _`
end

1. A small correction: it's not strictly necessary that the encoding be embedded in the metric (afm2tfm can accept it from a separate file), but it's convenient. PS: I've discovered that ttf2afm has an option to merge an external encoding. Some day I'll modify the script to exchange the Ghostscript and ttf2afm steps.

2. I've just noticed that kerning info disappears in afm2tfm. Oh sigh.

3. There's a ttf2tfm on my machine; I'm not sure why I decided against it.


created 2001 Jun 15
last modified 2002 Jan 25 1