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

Using the Font Imaging library

The Font Imaging Library provides a scaler-independent interface to Apple's glyph-imaging code. It is not a part of the Mac OS, but it is supported by Apple's font group. It provides an officially sanctioned way to draw arbitrary glyphs in a TrueType font. Although it is officially sanctioned, it is not guaranteed to be bug-free; problems should be reported to Apple.

There are currently three TrueType scalers which have been used in the Mac OS:

  1. The TrueType 1 scaler (also known as the "Bass traps"). This was the first TrueType scaler used in the Mac OS and was used by QuickDraw text through Mac OS 8.1.
  2. The QuickDraw GX scaler.
  3. The ATS scaler. This was introduced with Mac OS 8.5 and is used by both QuickDraw text and ATSUI in Mac OS 8.5 and later versions of the operating system.

Note that the Bass traps are still present in Mac OS 8.5, but they are no longer maintained and should not be used.

Other TrueType scalers may become available with future versions of the Mac OS.

Outside of Apple, there is the FreeType TrueType scaler. The Font Imaging library does not currently support the FreeType scaler, but we plan to add support for it in the future.

The Font Imaging Library will automatically select a scaler to use if more than one is available. This selection can be overriden by the client.


The Font Imaging library interfaces

The functions are relatively self-explanatory and straightforward to use. A couple of notes:

We currently provide two ways for accessing the old "Bass trap" TrueType scaler. One is through the Bass traps proper, which continue to be available in the MacOS through MacOS 9.0 at least. The other is through a copy of the Bass trap code compiled into the Font Imaging library. This is compiled as PowerPC code and should execute more quickly, and it will work on systems from MacOS 8.5 onwards.

Applications that use the FIL will need to include the resources in FontImagingLib.rsrc.

The Font Imaging Library uses an opaque structure, the FIUContext. These are created and deleted by the Font Imaging Library and used as a paramter to all the other functions. A FIUContext uses a fixed scaler; once you create one, you cannot change the scaler it uses. Do not make any assumptions about the amount of memory occupied by an FIUContext; that will vary from scaler to scaler and with different versions of the Font Imaging Library. Only use FIL functions to create and delete FIUContexts.

An FIUContext can either be created from a complete TrueType font in a Handle in memory or from a file. In the former case, you will be required to dispose of the Handle yourself; the FIL makes a copy.

The FIL creates temporary files that it uses to access glyph data. Sufficient room will be needed on your boot disk to hold a complete extra copy of the font.

Most the functions return an OSStatus to indicate success or failure. There are no FIL-specific error codes.

Point sizes are fractional, as is the case with Apple Type Services for Unicode�Ѣ Imaging (ATSUI).

The outlines returned are QuickTime paths. They are identical with QuickDraw GX paths; the specific format for the paths is found in Inside Macintosh: QuickDraw GX Graphics, pages 2-106 through 2-108, which is available at:

ftp://ftp.apple.com/developer/Technical_Publications/Archives/QDGX_Graphics.sit.hqx


Support files

In the ":Support Files:" directory are FontImagingLib.rsrc and GlyphViewer. The former is a set of resources that you should include in your application for FIL to work properly. The latter is a simple application that will check FIL support on your machine.


Version history and release notes

Version 1.0b2

  • 1999 ATypI release.
  • Updated to work properly with the ATS scaler on MacOS 9.0.
  • Added support for a compiled-in copy of the Bass trap code.

Version 1.0b1

  • 1999 WWDC release.

Version 1.0d6

  • First public release.


Known problems

  1. The outlines returned by FIUCreateOutline() are not always positioned correctly relative to the glyph's origin.
  2. FontLab reports extreme instability and frequent crashes on pre-8.5 versions of the Mac OS using the True Type 1 scaler, usually in the trap fs_CloseFonts(). We have been unable to reproduce this problem at Apple.

��