Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Adding Basic AAT Support to a Font

This document takes you through the basic steps to use Apple's font tools to convert a font for use with AAT (Apple Advanced Typography). The font used as a sample is JSL Ancient by Jeff Lee. Jeff has made these fonts available as "emailware" and are available on the Web. Note that Jeff doesn't want people to distribute changed versions of his fonts.

Be aware that the steps below reflect versions of Apple's font tools current as of mid-April 1999. The exact results obtained from using other versions may differ. Check Apple's font tool site to make sure you have the latest version of all the font tools.

Step 1. Make sure the file type is correct.

This may be an issue for data-fork fonts pulled off the Internet—that is, TrueType fonts designed for use with Microsoft Windows. The Mac OS does provide some support for data-fork fonts, but it has to know that they are, in fact, fonts. In the Windows world, file types are generally indicated by a file's extension (e.g., ".TTF" for TrueType fonts). In the Mac OS, this is done by setting the file's type.

The file's type is not generally accessible to the end user. You'll need a special utility to do this. One readily available one is Apple's resource editor, ResEdit. If you select the "Get File/Folder Info…" item in the "File" menu, you'll be able to access a great deal of information about any file on your Macintosh. Among these is the file's type (the "Type" item in the dialog). Change this to "sfnt", all lower-case, and no more than these four letters. None of the other fields need be changed.

Most of Apple's font tools use the file type to guarantee that they're working on a TrueType font. Indeed, they won't even let you attempt to work on files of any other type, so this is important.

Note that this isn't an issue for Macintosh fonts, only for Windows fonts copied onto a Macintosh. Fonts created for use on the Macintosh originally will already have their file type set correctly.

Step 2. Run FontValidator and fix any problems you find.

FontValidator is Apple's tool to do basic diagnostics for TrueType fonts. Not every problem FontValidator reports will keep a font from working, but it does catch literally hundreds of potential problems and any problem it reports should be taken seriously.

(At the same time, there are probably problems with fonts which are not reported by FontValidator; please contact Apple if you are aware of any.)

JSL Ancient is a fairly clean font. FontValidator has comparatively few things to say:

There are five errors and ten warnings; in this case, let's focus in on the errors. You can turn off the warnings and points of information from FontValidator's report by clicking on the appropriate icons.

You can also save FontValidator's report as a text file to be examined at liesure.

Of the five errors, we can discount some immediately. Not having a 'FOND' resource is a problem for a resource-fork font which is intended to be used with QuickDraw Text. Data-fork fonts or fonts intended only for use with ATSUI don't need a 'FOND'.

The other errors have to do with the font's 'name' table. None of them are surprising, as they are all known artificats of fonts created using Fontographer.

Of the four only one is severe enough to require being fixed. Fonts are technically allowed to have multiple "unique" names, although this may confuse some tools and hence is flagged. Overlapping names is not a problem that has any known ramifications. Some tools, however, are known to fail if a font has more than one PostScript name. We'll go ahead and fix this one.

A font's 'name' table can be examined and edited using TrueEdit. We open the font with TrueEdit and double-click on the 'name' table to edit it.

To delete a name, simply select it by clicking on it and hit the Backspace key. Save the font and quit TrueEdit.

Step 3. Fix the PostScript names

We may have quit TrueEdit a bit prematurely, however. TrueEdit will also display a glyph pallet for a font; when you print the pallet, it includes the font's PostScript names for the individual characters.

(Note: If you just open and close a font with TrueEdit, it may ask you if you want to save changes even if you haven't done anything. Not to worry. This is a result of another known problem with current versions of Fontographer; they don't have correct checksums in the font's directory. This isn't a problem in any known situation but should be fixed anyway. Go ahead and save the changes if you like. ChecksumFixer will also cure this problem.)

With the glyph pallet from TrueEdit in front of us, we note that of the 220 characters in the font, six have PostScript names which could be fixed, although only three are positively wrong.

For example, glyphs 102 and 103 are named "dagger" and "daggerdbl," respectively, which is clearly incorrect for an "long-s t" and "long-s h" ligature. Glyph 99 is named "florin," which is also wrong.

Fixing the problem requires DumpPOST. This will create a text file with the PostScript names for all the charcters in the font.

There are a number of choices as to what we can change them to.

We can give the glyphs names of the form "cNNN," where "NNN" is some decimal number. In this case, the PostScript name becomes a meaningless tag which cannot be parsed by either tools or people.

If the glyphs in question corresponded to Unicode code points, we could give them a name of the form 'uniXXXX', where XXXX is the four hexadecmial digit Unicode code point. Even without a copy of the Unicode standard, you can find characters using the on-line charts.

As it happens, Unicode does have a number of Latin ligatures defined, and the "long-s t" ligature, in particular, is at U+FB05, and the long-s is found at U+017F. (Note that the former is a "presentation form" in Unicode, meaning that its use as an individual character is discouraged.)

We could use names from Apple's database of PostScript glyph names recognized by the AAT Font Tool. The main advantage of this is that using glyph names from this table will guarnatee that correct default ligatures and cmap entries will be generated by the AAT Font Tool automatically.

It is also possible to follow Adobe's guidelines for giving glyphs PostScript names. This course is also highly recommended.

"slong" and "ff" are found in Apple's database. The other four aren't (yet), but would have names such as "slongt", "slongh", "slongsmedial" and "ct". We opt to use these.

First we create a text file using DumpPOST, and then we edit it with any text editor to get the names we want.

If we like, we can use AAT Font Tool or FusePOST to put the new names back into the font. We, however, are going to hold off for the moment.

Step 4. Create MIF, JIF, and other fun tables

The AAT Font Tool is the basic tool for adding font features (such as swashes, contextual forms, and ligatures) to a font. There's a lot more it can do, too. By default, for example, it will add a number of accented characters if all their pieces are present and add some default ligatures.

In our case, we're interested in two things:

  1. We want "s" to turn into "long-s" in the middle of a word, and
  2. We want a number of ligatures to form automatically.

Neither of these are done by default by the AAT Font Tool so we'll have to set up a "morph input file" (MIF) to do what we want.

We don't need to go into detail here on how to create the MIF for our font; the complete instructions are on the Web. In our case, we add a single contextual list and a ligature list. The former makes "s" turn into "long-s", and the latter adds the ligatures we're interested in. Note that order is important; we don't want the ligatures to form first.

Here's our MIF:

Type Contextual
Name Smart Swashes
Namecode 8
Setting Nonfinal Swashes
Settingcode 4
Default yes
Orientation HV
Forward yes
Exclusive no

s s
Letter a b c d e f g h i j k l m n o p q r t u v w x y z
+ A B C D F G H I J K L M N O P Q R S T U V W X Y Z
Other space zero one two three four five six seven eight
+ nine exclam quotedbl numbersign dollar percent ampersand
+ quotesingle parenleft parenright asterisk plus comma
+ hyphen period slash colon semicolon less equal greater question at


EOT OOB DEL EOL s Letter Other
StartText 1 1 1 1 2 1 1
StartLine 1 1 1 1 2 1 1
FoundS 4 4 4 4 3 4 1
TwoS 4 4 4 4 3 4 1

GoTo Mark? Advance? SubstMark SubstCurrent
1 StartText no yes none none
2 FoundS yes yes none none
3 TwoS yes yes ChangeS none
4 StartText no yes ChangeS none

ChangeS
s slong


Type LigatureList
Name Ligatures
Namecode 1
Setting Rare Ligatures
Settingcode 4
Default no
Orientation HV
Forward yes
Exclusive no

List
slongt slong t
slongh slong h
slongsmedial slong slong
germandbls slong s
ff f f
ct c t

Note that we've turned both our effects on by default. This makes GX- or ATSUI-savvy applications show our effects even if they don't provide controls for font features.

With our MIF in place, we can run the AAT Font Tool over the font. While we're at it, we change the glyphs' PostScript names, add the Unicode and Mac OS cmaps, and do the various other tasks that the AAT Font Tool provides by default.

(The MIF as given has a bug. An initial "s" will also be turned into a "long s". Fixing this bug is left as an exercise for the reader.)

Step 5. Make the font available to QuickDraw Text

We're almost done. We've now got a font with some powerful AAT tables which can be used with ATSUI or QuickDraw GX. If the font was originally designed for Windows, however, it won't be accessible to the older text-drawing system on the Mac OS, QuickDraw Text. If we want it to, we'll have to convert it from a data-fork font to a Macintosh font suitcase.

Fortunately, there are a number of utilities to do this, the most easily found being TTConverter. You can get a copy of TTConverter at most Macintosh software archives on the Internet. TrueEdit can do it to; when you selct the Save As… menu item, there's a pop-up window that lets you select a file type. Select Font suitcase from the menu.

Note, by the way, that the step of creating Mac OS cmaps wasn't done by TTConverter. The AAT Font Tool will still be needed to do that before the font can be used with QuickDraw Text. And for the AAT Font Tool to do its job correctly, you still need to get the PostScript names for the glyphs in the font as correct as possible.

With a font suitcase in hand, you can drop it on a closed System folder and it will be installed. (This will also work with data-fork fonts in Mac OS 8.5 and later, if you're willing for your font to be used only by QuickDraw GX and ATSUI.)

And we're done;we confirm that our fancy features have showed up automatically as a quick check with an ATSUI-savyy application will show. By default, we'll display the phrase "Fast Sassafrass Teas in Fact" thus:

but using control of font features, we can make it show up as: