As you have probably arrived at this page because you want to know about TrueType instructions and how to edit them, an extremely short introduction into hinting is given here. If you want to read more, or if you do not yet know what glyphs or contour points are, you may want to find your way to more general information available on the web before diving into this.

If you have any comments to this tutorial (if you can call it that) or any suggestions, questions, or anything at all, please send me a note.

The relevant bit of the history of font file formats starts with Type 1 fonts. The Type 1 font file format was invented by Adobe in 1985 and is used in the Postscript printer language and in PDF (Portable Document Format) files. It is an outline format, that is, the glyphs are specified by their outlines (by cubic splines). TrueType was invented by Apple around 1988, but Microsoft has got the rights as well, and they are now the main promotors. It is an outline format as well, but it uses conic splines. Though cubic splines form a superset of conic splines, they can be converted to conic splines, in which case sometimes a number of extra points are needed to represent the original splines. The distortion this results in is usually minimal because of the high resolution used to specify the outline points. On the other hand, conic splines are mathematically less complex, so that they can in principle be rendered more quickly.

What are TrueType instructions?

That's a difficult question to answer in three sentences. One major problem in using outline font files on low-resolution devices such as computer screens is what was described by Microsoft in an article promoting TrueType. Basically, outlines may fall off pixels or turn on more than one pixel row at random, because they are scaled down to a given number of pixels. In Type 1 fonts, it is tried to solve this by using hints.

Hints

Hints are things that tell the rasteriser (the program that renders a string of characters to a surface) something about the topology of the character. For example, they may identify the two horizontal stems and the vertical one of the character "H". More advanced descriptions are available as well. The hints are normally added by the font designer or another human being, though the computer may be able do some things automatically.

It should be clear that the rasteriser has to use these hints to display glyphs well. This is not at all a trivial task. Usually the glyph is stretched so that the stems fit the pixels in some way. Italic characters or slanted stems are extremely difficult to get right. Whatever smart algorithms are used, some glyphs will always look slightly less than perfect.

Instructions

The way to make sure small glyph bitmaps look perfect is, obviously, create them by hand. The instructions that TrueType uses can do this, though it may take a lot of work (most of which must be done by humans). TrueType instructions allow the designer to include programs with every glyph to distort the outline in any way the designer wants it to. This should not be called hinting, as it has more to do with commanding than with hinting, but it is often called hinting anyway. So, when it says "TrueType hinting" somewhere, it should be "TrueType instructing". The instructions are executed by a Virtual Machine.

The instructions have many advantages: everything you want to do can be done. You may, for example, want to remove all stems at lower sizes, or to delete other features not necessary to convey what character the glyph represents. It also means that hinting done in any other hinting system may be converted to TrueType instructions, though this does not necessarily lead to good-looking fonts compared to manually instructed ones.

Producing TrueType Instructions

The abundance of not-terribly-well hinted fonts available from everywhere makes painfully clear that hand-hinting is a difficult job for which it is difficult to produce tools. Microsoft has its Visual TrueType tool which is said to work pretty well. FontLab has got a rather limited set of instructions which do allow access to the instruction set in a visual way.

The TrueType Instruction Compiler

Knowing that TrueType fonts basically contain small programs, however, I was amazed to find how few tools for actually programming TrueType instructions were available (zero, to my knowledge). This was why I made my own tool. Its input consists of a programming language which may be characterised as a simplified version of C. The fact that programming skills are required may immediately be seen as evidence that it is not as easy to use the TrueType Instruction Compiler, as I called it in an extremely creative mood, as it is to use more visual tools. However, it is more powerful and as I did not add many difficult constructions or anything a basic knowledge of any procedural or object-oriented programming language will do.