Metatype FAQ

What is Metatype?

Metatype is a framework for creating TrueType fonts based on Metafont language. It consists of several utilities, scripts and makefiles, and includes the TeX family of fonts, based on D.E.Knuth's Computer Modern font sources.

The ultimate goal of a Metatype project is creating a set of high quality freeware fonts, suitable both for printing and for using as display fonts.

What is Metafont?

Metafont is a programming language for describing the shapes of the font glyphs. It was written by D. E. Knuth as a companion to TeX. Metafont compiles the font sources to raster bitmap images.

Metafont's language for defining fonts permits the expression of several classes of things: first (of course), the simple geometry of the glyphs; second, the properties of the print engine for which the output is intended; and third, 'meta'-information which can distinguish different design sizes of the same font, or the difference between two fonts that belong to the same (or related) families.

Knuth (and others) have designed a fair range of fonts using Metafont, for example the famous Computer Modern font family.

(See also TeX FAQ)

What is Metapost?

The MetaPost system (by John Hobby) implements a picture-drawing language very much like that of Metafont except that it outputs Encapsulated PostScript files instead of run-length-encoded bitmaps. MetaPost is a powerful language for producing figures for documents to be printed on PostScript printers, either directly or embedded in other documents.

Much of MetaPost's source code was copied from Metafont's sources with Knuth's permission.

Metapost can also be used for converting fonts from Metafont sources to Postscript Type 3 format.

(See also TeX FAQ)

Your fonts look ugly. What is wrong?

For TrueType fonts looking good in low resolution, they must contain so called "hints", or small assembler-like programs for every glyph, which help rasterizer to display glyph "the best". Currently, Metatype fonts have no hints, that's why they look ugly in point sizes 14 and lower (when no anti-aliasing is available).

Creating hints is a very hard task. To overcome this, there is another method: precomputing bitmap font images for all popular low-resolution font sisez and putting them into TrueType file. Currently this is not implemented yet.

I downloaded and unpacked Metatype sources. How do I compile the fonts?

The procedure is described in metatype/README file. In a brief: (1) install all required packages, (2) go to metatype/ directory and run "make"; (3) go to maestro/cm/compile/roman (or another font face directory of your choice) and run "make", then "make ttf". You will get the file texr.ttf (or another name, according to font face).

What about support for extended latin (arabics, hebrew, devanagari etc etc)?

This is our goal: adding support for as most Unicode characters as possible. You are welcome to participate and help us with it! There is a lot of freeware Metafont fonts in the Internet. Find the suitable font, add all needed characters to Metatype font source directories, or build your own font.

I like your project. How could I volunteer?

Yes, of course! There is a list of task of most importance. You can select one for you taste and develop the project in this direction.
  • Support for precompiled bitmaps into TTFs. In TrueType terminology, these bitmaps are called sfnts. Metatype uses Fonttools Python library for creating TTFs, and unfortunately, there is no support for sfnts in Fonttools. So this task required extending Fonttools with sfnts, and then adding the approproate part to mk_ttx.py script of Metatype.
  • Extending the character set of available TeX font with: Latin extended letters, Arabics, Hebrew, Armenian, Devanagari and so on, up to Japanese, Chinese and Korean.
  • Inventing a method of direct glyph convertion, using Metapost, to cubic curves and then to conic outlines, without need for autotracing bitmaps.
  • Developing a utility for automatic kerning the fonts. Look at pfaedit sources.
  • Developing a utility for automatic hinting. Some commercial font editors have such a feature.

I have Metafont sources of some font. How could I convert it to TrueType using Metatype?

  • Create subdirectory for your font, say:
    mkdir metatype/myfont
    cd metatype/myfont 
  • Create subdirectories for every 256-character block:
    mkdir 00 01 
  • For every block, create the file of symbol codes. File metatype/unicode.mf contains a list of all Unicode symbols, so you could extract it from here. Or just copy the appropriate file from cm/ directories:
    cp ../cm/00/encoding.mf 00/encoding.mf
    cp ../cm/01/encoding.mf 01/encoding.mf 
  • Create subdirectories for every 16-character subblock:
    mkdir 00/002 00/003 00/004 00/005 00/006
    mkdir 00/007 01/013 
  • Split your font sources and put every character into separate file. Place these file into subblock directories, according to character codes. For example, small latin "a" has Unicode encoding 0061 (hex), and it must be placed as 00/006/0061.mf. Edit the glyph sources and replace the first argument of "beginchar" macro with glyph name from encoding.mf. Your sources must look like:
    beginchar (LATIN_SMALL_LETTER_A,...
    ...endchar; 
  • Create the myfont/compile directory and copy the Makefile here:
    mkdir compile
    cp ../cm/compile/Makefile compile/Makefile 
    Put your font's base file here. If your font is based on original Computer Modern family, then your base file is probably named "cmbase.mf":
    cp $(somewhere)/cmbase.mf compile/base.mf 
  • Create the font face directory and create the file of parameters here. For example, the cm/compile/roman/param.mf parameters file for TeX Roman font face is based upon the original "cmr10.mf" file.
    mkdir compile/roman
    vi compile/param.mf    # put parameters here 
  • Copy a Makefile into the font face directory, and edit it:
    cp ../cm/compile/roman/Makefile compile/roman/
    vi compile/roman/Makefile   # edit font name, etc 
    You can create as much font faces as you wish, with different parameters.
  • Edit the main compilation Makefile and put a list of all font face directories in it (SUBDIRS variable).
    vi compile/Makefile    # edit SUBDIRS 
  • You are now ready to compile the single font face:
    cd compile/roman/Makefile
    make       # compile glyphs
    make ttf   # convert glyphs to ttf 
    Or you could compile all font faces at once:
    cd compile/Makefile
    make       # compile glyphs
    make ttf   # convert glyphs to ttfs 

    That's all!

  • Copyright (C) 1996-2001 Serge Vakulenko
    serge@vak.ru