Jump to: Navigation.

Adding Graphite and AAT to a Font

On this page:

Who should read this?

This page is addressed to any font developers who want to add smart Graphite or AAT features to their fonts. It is not intended as a comprehensive guide, but as an introduction. We hope we can share the experiences we’ve gained from adding smart Graphite and AAT features to the Free Tengwar Font Project. On this page, we will try to explain problems we’ve run into and solutions we’ve found.

When we started with adding both Graphite and AAT features to the Free Tengwar Font Project fonts in late 2009, we were scared off because we thought it would be too difficult for us. Half a year later, we’re not scared off any more (and it certainly didn’t take the entire half year, but only some hours of our spare time every few weeks). Looking back, we think a major problem was lack of information. There is plenty of technical information, but there is hardly any low-level information. Normally, when you run into a computer problem, google will find lots of low-level information like forum threads or mailing list archives or blog posts or introductory sites. There’s hardly anything like that for smart font technologies. Hopefully, this page will contribute to changing that.

Comparison of smart font technologies

Developing a (tengwar) computer font requires smart font features. The first problem about smart font features is that there are several smart font technologies, each one with its shortcomings:

OpenType is a widely used technology for smart font options, implemented (at least partially) on virtually all modern computers. Applications that support advanced OpenType features will typically only support them with certain scripts (for instance the Arabic alphabet etc.). This makes OpenType very powerful for standardized scripts, but unsuitable for non-standardized scripts such as the tengwar.
Apple Advanced Typography (AAT)
Apple Advanced Typography encodes all smart font features within the font file. Therefore, it is well suited for a non-standardized script such as the tengwar. It is however a proprietary technology that can only be used and built on Mac OS. Also, it is hard to find additional documentation when you encounter a problem.
Graphite is being developed as a free alternative to AAT. Like AAT, it encodes all smart font features within the font file. That makes it well suited for a non-standardized script such as the tengwar. It is however not widely implemented. The only major applications that natively support Graphite are XeTeX and the Windows and Linux versions of OpenOffice.org ≥ 3.2. Linux systems and Windows XP (but not Vista or 7) may be configured so that other applications will support Graphite.


Graphite Prerequisites

The basic requirement for building Graphite fonts is the Graphite compiler, a command-line tool that allows adding Graphite information to a font. There are several ways of installing the Graphite compiler, depending on your OS:

Graphite Documentation

Graphite documentation is available from the Graphite page at the SIL site. The documents that are relevant for adding Graphite to a font are GDL Tutorial for smart font developers (GraphiteTutorial_zip.zip) and Graphite Description Language (GDL.pdf).

In addition to these files, you may want to check out the GDL files that are included with the various Graphite fonts from the Graphite Font Download page at the SIL site. These are helpful real-world samples, and they contain plenty of annotations.

In comparison to the AAT documentation, the Graphite documentation is more extensive and more reliable. Additionally, there is a better chance that google will provide helpful pages when you encounter a problem.

Graphite Description Language Files (GDL)

A Graphite Description Language file (GDL) is what you will be working with when adding Graphite to a font. Some observations:

Graphite Bugs and Workarounds


AAT will only work on Mac OS, so if you don’t have a Mac, the following information will not be very helpful to you. If you wonder why this page has much more information about AAT than about Graphite: It is because the available Graphite documentation is more extensive and more reliable.

AAT Prerequisites

  1. Install Apple’s Font Tools. You can download the installer package of Font Tools Release 3.1.0 for free from Fonts & Text Downloads - Apple Developer. It is a set of command-line tools and of various documentation files. For all we know, you can only install them on Mac OS X. You need administrator access to your computer for the installation.

  2. You need a TTF font. Apple’s Font Tools do not create fonts; they only add AAT rules existing fonts. If you want to create a font yourself, we’d recommend the free outline font editor FontForge. If you already have a font, install FontForge anyway (also requires administrator access). It will be a handy tool for inspecting your font.

  3. Some knowledge of the command line interface will be helpful, since Apple’s Font Tools mainly consist of command-line tools. However, the tutorial that is installed with the Font Tools documentation is very considerate of people unfamiliar with the command line, so we guess previous knowledge of the command line is not necessarily required.

About Apple’s AAT Documentation

The documentation that is installed with Apple’s Font Tools is most helpful. It will be installed in the folder /Developer/Documentation/FontTools/. It is the starting point for anybody interested in AAT development. Especially the tutorial and the file Apple Font Tool Suite.pdf are very important resources to anyone who wants to do AAT development.

In fact, we have found hardly any other useful documentation about AAT on the net. The Mac Malayalam page by Manoj and Vinod Prabhakaran provides a helpful example of a Morph Input File (it taught us how to do insertion). You can get another MIF from Michael Everson’s page on Designing and producing fonts for N’Ko.

This page is no substitute for Apple’s documentation. These are just some remarks about what we experienced:

We recommend the tutorial as a starting point. In addition to the main file Tutorial.pdf, the tutorial folders include dozen of helpful files, including actual fonts, for each step of the tutorial.

For the purpose of developing a smart (tengwar) font, the tutorial is somewhat imbalanced. The first three lessons are all about completing the font so it will perfectly validate, while only the fourth lesson is really about smart font features. Completedness and validation, however, are not necessary for the smart font features. They are nice to have, but fonts will work perfectly without them. We still recommend the first three lessons of the tutorial. They will get you acquainted with the way the Font Tools work.

The tutorial supposes you’re working with a commercial font editor, especially with FontLab. Don’t worry about that, FontForge will do just fine.

Apple Font Tool Suite.pdf
The Apple Font Tool Suite.pdf file has two parts: First an explanation of the various Font Tools command-line utilities (kind of their missing man pages); second detailed descriptions of input files that are required for adding certain AAT features.
Inaccurate Information in the AAT Documentation
Beware that some of the information in Apple’s Font Tools documentation is inaccurate. Maybe the documentation describes an older version of the Font Tools and was never updated. Fortunately, most things still work. Here is some inaccurate information we have found:
  • Add lists work differently (if you’d ever wish to use them): The utility ftxenhancer -A will not accept the plain text add lists that are described in the documentation, but requires an XML add list. Luckily, the tool ftxanalyzer -g will create such an XML add list, and not a plain text add list as desribed in the documentation. The correspondance between the described plain text add lists and the required XML add lists is pretty straightforward.

  • The tools used for font examination are long outdated, and many don’t exist any more, for instance the tool TrueEdit for viewing glyph numbers, or the tool WorldText for controlling typographic features. Glyph numbers can be viewed with the Character Palette or with FontForge, typographic features can be controlled with TextEdit.

  • The tutorial mentions a Kerning Input File (KIF), parallel to the Morph Input File (MIF) and the Justification Input File (JIF). However, there is no documentation whatsoever of a Kerning Input File. Appearently, Apple’s Font Tools are incapable of adding AAT kerning to a font. We’ve found only one way of adding AAT kerning to a font: FontForge’s Mac State Machine Dialog. All Apple provides are two Mac OS 8.5 tools from 1999, DumpKERN and FuseKERN (available at Apple - Font Tools), but we haven’t been able to use them (when we tried SheepShaver, an open source PowerPC emulator, DumpKERN and FuseKERN would run, but we couldn’t actually open any font).

Outdated AAT Documentation at Apple’s Developer Site
Beware that the AAT documentation that can be found online at Apple’s developer site does not match the AAT documentation that is installed with Font Tools Release 3.1.0. The copyright notices indicates that the documentation at Apple’s site is from 2002, while the documentation installed with Apple’s Font Tools is a revision from 2006. The most important difference we’ve found is in the file Apple Font Tool Suite.pdf: The 2006 version has an additional section with the name MIF Format—Some general considerations.

For the most part, however, the outdated 2002 documentation at Apple’s developer site is not very different from the more recent 2006 revision, so we’re including the links here: There is the main file of Apple’s Font Tools tutorial, Tutorial.pdf, as well as the file Apple Font Tool Suite.pdf. Additionally, some sections of the latter are available as independent HTML pages from How to use the AAT Font Tool, especially the section about Morph Input Files (see below).

AAT Morph Input Files (MIF)

The most important aspect of Apple’s Font Tools are the Morph Input Files (MIF). It comes down to this: First you write a Morph Input File in a text editor (if you use TextEdit, make sure it is a plain text document); then you add this Morph Input File to your font with the command-line utility ftxenhancer. Since that utility overwrites the font, you might want to copy it first, for instance with the command-line utility cp:

cp noAATfont.ttf AATfont.ttf
ftxenhancer -m MorphInputFile.mif AATfont.ttf

For most questions, Apple’s AAT documentation will give the answers. Both the sections in Tutorial.pdf and Apple Font Tool Suite.pdf are very useful. However, there is a number of tricks we have stumbled upon that were not answered there. Not that these will probably not be very useful unless you have read Apple’s AAT documentation (for instance the Morph Input Files section of the 2002 Apple Font Tool Suite.pdf).

General Observations about Morph Input Files

Observations about MIF rule headers

Observations about MIF rule bodies

Short note about OpenType

OpenType is very powerful with standardized scripts. It is not suitable for non-standardized scripts such as the tengwar (see for instance the section about the Pollard script in John H. Jenkins The Unicode Character-Glyph Model: Case Studies).

We’ve found one OpenType feature that works even in the Personal Use Area of Unicode: OpenType Ligatures (at least in some applications such as Firefox or OpenOffice.org). They can be added to a font for instance with FontForge, as described in the section Lookups and Features of the FontForge tutorial. Of course, ligatures have only very limited capabilities and cannot do all the smart rendering required for a proper tengwar font.