Under Construction

A Worked Simple Example of TeX Virtual Fonts

For a title page, I had selected faces Effloresce and EileenCaps as going together.1 But their baselines didn't match, and the kerning of Effloresce was poor.2 I initially corrected it with a lot of manual shifting and kerning:

\font\Z zefflores at20pt\Z\baselineskip15pt
\centerline{The}
\smallskip
\centerline{\font\X zefflores at30pt\X\font\Y zeicbl at30pt\def\I#1{\lower.07em\hbox{\Y#1}\kern-.05em\relax}%
 \I Unit\kern-.06em e\kern-.05em d
 \I B\kern-.04em aptist
 \I Chur\kern-.10em c\kern-.03em h}
\smallskip
\centerline{of Chester, Nova Scotia}
(rendering of above)
Note, too, that I only kerned one t-e pair; the lower one is still too wide. And there are other pairs still needing work; I only tweaked the line of larger type.

This is one of those moments for which TeX's virtual fonts were made (and a moment in which word processors and most typesetters fall flat on their faces). I can wrap Effloresce in a VF that corrects its kerning, and then wrap Effloresce and EileenCaps into a VF that replaces the caps, corrects the baselines, etc.

Kerning Effloresce

If one decodes the metric file produced for Effloresce (see my TTF pages) one notes that there's no kerning at all:

tftopl -charcode-format=ascii /usr/pkg/share/texmf/fonts/tfm/*/*/zefflores.tfm | more
This is strange because the .afm file has heaps o' kerning -- damn. I'll skip this pending further investigation.3

Mixing Effloresce and EileenCaps

First I get out and study the property lists of the two faces, plus the PL of a VF because information is so scarce (there's this but it's nice to have a sample):

tftopl -charcode-format=ascii /usr/pkg/share/texmf/fonts/tfm/*/*/zefflores.tfm>efflores.pl
tftopl -charcode-format=ascii /usr/pkg/share/texmf/fonts/tfm/*/*/zeicbl.tfm>eicbl.pl
vftovp -charcode-format=ascii /usr/pkg/share/texmf/fonts/vf/adobe/agaramon/padr9o.vf>sample.vp

We start our virtual property list with the obvious (PL keywords are case-insensitive so I've downcased for easier reading):

(designsize r 10.0)
(fontdimen
   (slant r 0.0)
   (space r 0.25)                ******
   (stretch r 0.3)
   (shrink r 0.1)
   (xheight r 0.4)
   (quad r 1.0))
(mapfont d 0
   (fontname zeicbl)
   (fontat r 1.0)
   (fontdsize r 10.0))
(mapfont d 1
   (fontname zefflores)
   (fontat r 1.0)
   (fontdsize r 10.0))
The two faces agreed on all values except space; I'll review that value when I better understand it.

I retain kerning information between glyphs drawn from the same face (intraface kerning info). In this case, cap-cap kerns from zeicbl and noncap-noncap kerns from zefflores. (But I have no kerning information in either face at the moment, so I skip this step.)

Next I create interface kern info.

Then I copied the character metrics from efflores.pl, omitting the caps:

(character c !
   (charwd r 0.27)
   (charht r 0.773)
   (chardp r 0.008))
...
(character o 377
   (charwd r 0.465)
   (charht r 0.723)
   (chardp r 0.166))

Then I copied the capital metrics from zeicbl.pl, adding mapping commands (by use of sed):

(character c A
   (charwd r 0.947)
   (charht r 0.85)
   (map (selectfont d 1) (setchar c A)))
...
(character c Z
   (charwd r 0.982)
   (charht r 0.861)
   (map (selectfont d 1) (setchar c A)))

At this point it's possible to try out the mix: compile the VPL with vptovf; hook the .vf and .tfm files symbolically where TeX can find them and run texhash; then write, set, and view a little test document.

Notice the caps are still too high. I had lowered them by 0.07 em in my final title page. A movedown command is easily search-n-replaced into the VPL to do the job:

(character c A
   (charwd r 0.947)
   (charht r 0.85)
   (map (selectfont d 1) (movedown r .07) (setchar c A)))
...
(character c Z
   (charwd r 0.982)
   (charht r 0.861)
   (map (selectfont d 1) (movedown r .07) (setchar c Z)))
and another test run shows the improvement. But! moving a glyph demands changes in its metrics. I have to subtract 0.07 from each cap's height and should add a depth:
(character c A
   (charwd r 0.947)
   (charht r 0.78)
   (chardp r .07)
   (map(selectfont d 1) (movedown r .07) (setchar c A)))
...
(character c Z
   (charwd r 0.982)
   (charht r 0.791)
   (chardp r .07)
   (map(selectfont d 1) (movedown r .07) (setchar c Z)))
Whew -- I begin to see where a script like fontinst becomes vital, especially since the 0.07 shift isn't right for all the caps.

I need to go simpler (continue).


1. Linuxpower.org shut down 2002 Jun 2 :(

2. I was using an Effloresce found on fonts.linuxpower.org. It's possible Larabie has refined the kerning since then. I know I've refined the kerning in my local copy, which is why the topmost illustration doesn't match the text. =7

3. It's because afm2tfm ignored the kerning info; see my TTF notes.


created 2002 Jan 25
last modified 2002 Oct 31 1