UK TeX FAQ -- question label virtualfonts

### Virtual fonts

Virtual fonts provide a means of collecting bits and pieces together to make the glyphs of a font: the bits and pieces may be other glyphs, rules and other “basic” typesetting commands, and the positioning information that specifies how everything comes together.

Things that match the concept of virtual fonts for TeX were first implemented by David Fuchs in the very early days. However, for practical purposes for the rest of us, virtual fonts date from when Knuth specified a format and wrote some support software, in 1989 (he published an article in TUGboat at the time, and a plain text copy is available on CTAN).

Virtual fonts provide a way of telling TeX about something more complicated than just a one-to-one character mapping. The entities you define in a virtual font look like characters to TeX (they appear with their sizes in a TFM file), but the DVI processor may expand them to something quite different.

From the virtual font file, the DVI processor learns details of what is in the virtual font, so as to know “what to draw, where”. The virtual font may contain commands:

- just to remap the glyphs of a single font,
- to make a composite font with glyphs drawn from several different fonts, or
- to build up an effect in arbitrarily complicated ways (since a virtual font may contain anything which is legal in a DVI file).

In practice, the most common use of virtual fonts is to remap Adobe Type 1 fonts (see font metrics), though there has also been useful useful work building ‘fake’ maths fonts (by bundling glyphs from several fonts into a single virtual font). Virtual Computer Modern fonts, making a Cork encoded font from Knuth’s originals by using remapping and fragments of DVI for single-glyph ‘accented characters’, were the first “Type 1 format” Cork-encoded Computer Modern fonts available.

Virtual fonts are normally created in a single ASCII VPL (Virtual Property List) file, which includes both sets of information. The vptovf program is then used to the create the binary TFM and VF files.

A “how-to” document, explaining how to generate a VPL, describes the endless hours of fun that may be had, doing the job by hand. Despite the pleasures to be had of the manual method, the commonest way (nowadays) of generating VPL files is to use the fontinst package, which is described in detail together with the discussion of PostScript font metrics. Qdtexvpl is another utility for creating ad-hoc virtual fonts (it uses TeX to parse a description of the virtual font, and qdtexvpl itself processes the resulting DVI file).

`fontinst`
  fonts/utilities/fontinst (or browse the directory)
`Knuth on virtual fonts`
  info/knuth/virtual-fonts
`Virtual fonts “how to”`
  info/virtualfontshowto/virtualfontshowto.txt
`qdtexvpl`
  fonts/utilities/qdtexvpl (or browse the directory)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=virtualfonts