etx, mtx, texnansi, afm2pl

Lars Hellström
Wed, 10 Jul 2002 21:30:45 +0200

At 15.08 +0200 2002-07-10, Siep wrote:
>I am working on a utility afm2pl, an afm2tfm replacement,  which as
>its default action produces a pl file with the original kerns and
>ligatures preserved; see

Why would you write such a thing? This is precisely what fontinst does[1]!
Furthermore fontinst (unlike what appears to be the case with afm2pl) runs
on any platform for which there is TeX (your afm2pl seem to require
porting) since it is written in TeX.

[1] Fontinst keeps the ligature glyphs in the original font, but ignores
the ligaturing instructions from the AFM file. What ligaturing instructions
one wants depends on the other hand on which the target encoding is, which
is why fontinst requires that ligaturing instructions are specified in the
ETX files. The ligaturing instructions in AFM files are usually terribly
insufficient for use with TeX.

>It is best used with
>texnansi encoding. It can also produce letterspaced fonts, with some
>caveats. The package includes a .enc file for uppercased texnansi.
>I would like to add fontinst inputfiles for generation of smallcaps.

If you want to fake smallcaps then you need to make virtual fonts, i.e.,
output a VPL in addition to the base PL.

>However, a lot of things about fontinst are fuzzy to me. Can anybody
>help out with some answers?
>- The latest teTeX, from late may, contains version 1.8; TeX Live 7
>contains version 1.9. Presumably, 1.8 files can still be used under
>1.9, but how much extra work would it be to change to 1.9 later on?

If you mean "how much would I have to change an afm2pl that understands
fontinst v1.8 files in order to have it understand v1.9 files" then the
answer is "probably quite a lot", but that's not the whole story. Since
fontinst files are TeX input, you would (to begin with) have to incorporate
a fairly complete TeX parser in afm2pl to have it understand fontinst files
for _any_ version. This is at least an order of magnitude greater than
simply supporting the new features in v1.9.

>- The role of mtx- and etx files is not at all clear to me. None of
>the supplied mtx files seem to contain information for e.g. the
>ellipsis character; there may be more such characters. Do I need to
>replace latin.mtx with a version which covers all the glyphs in
>texnansi? Or could I just make a supplementary mtx file? On the other
>hand, etx files also contains font metric information, viz. default
>font dimensions.  Why this duplication?

The basic function of fontinst is to generate VPL and PL files. There are
two phases in that process. In the first phase, fontinst reads a number of
MTX files. These define how a number of glyphs are constructed, essentially
in terms of "what needs to be put in a DVI file to print this glyph", by
storing information about them in various internal tables (implemented as
families of TeX macros) in fontinst. This information includes how the
glyphs kern. In the second phase, fontinst reads an ETX file (which
describes the encoding of a font) and creates the VPL or PL corresponding
to that font, by looking up in its internal tables the relevant information
about the glyphs mentioned in the ETX file.

There are many other parts of fontinst: creating the MTX file corresponding
to an AFM or PL file, transforming the metrics expressed in an MTX file,
writing the FD files needed to declare a font to LaTeX, converting (with
loss of information) ETX files to ENC files or vice versa, generating the
driver map file lines corresponding to the fonts installed, and more.

>- What are raw fonts? I understand that they are used as
>intermediate files. I got the impression that they are not usable
>for real typesetting, even if you don't care about kerns and
>ligatures. What pieces are missing?

A raw (a.k.a. base) font is any font which is not virtual. The PL files
that fontinst generates in such a way that they are not also installed for
LaTeX usually does not contain kerning, ligatures, or fontdimens for
efficiency reasons, but that is mainly a matter of what commands you give
to fontinst, not a restriction built into the program.

>- 8y.etx doesn't quite match texnansi.enc:
>    slot 8y.etx texnansi.enc
>    10   empty  cwm
>    160  space  nbspace
>    173  hyphen sfthyphen
>Why? Can I use the 8y.etx as-is with \installfont or should I make my
>own variation?

Well, it doesn't matter much since the above glyphs from texnansi.enc
usually neither exists in the fonts nor is used for anything AFAIK. Besides
the fact that the ENC used to reencode the font should match the ETX used
when generating a raw PL, there isn't much to say. Either way works.

Lars Hellström