Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Notes > Legacy Documents > Text & Fonts >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Font Family Numbers

CONTENTS

This Technical Note discusses the range of numbers available for identifying font families, how they are allocated among script systems, and what numbers should be used for fonts that were designed to be used as a tool in an application.

[Mar 01 1991]






Introduction

The txFont field in a GrafPort record is a signed word. This means that there are 32,768 positive numbers that can be used to identify font families (0 through 32,767). Currently these numbers are broken into groups and assigned to different script interface systems. Apple has also created a pseudo-script called smUninterp. This pseudo-script provides a range of numbers that can be used to identify fonts that are used as tools in an application. An example of this is the font used by MacPaintreg. for its palette symbols.

Back to top

A Brief History of Fonts Resources and Font Family IDs

There are, as of System 7.0, four types of resource for storing font data and font family information: 'FONT', 'NFNT', 'FOND', and 'sfnt'.

When the Macintosh was first introduced, all font data was stored in the 'FONT' resource. Fonts with the same typeface but different sizes were grouped together into families by storing a unique family ID in bits 7-14 of the font's resource ID and the font's point size in bits 0-6. The family was named by including a 'FONT' resource with a point size of zero. This method is documented in Inside Macintosh, I-234, The Font Manager. A disadvantage of this system was that, since the font family ID had to fit into eight bits, the range of numbers available was only 0-255; 0-127 were reserved for Apple, and 128-255 were available for third-party developers.

With the arrival of the 128K ROMs came two new resources, 'NFNT' and 'FOND', which are documented in Inside Macintosh Volume IV, chapter 5, The Font Manager. The 'NFNT' has the same internal format as the old 'FONT' resource, but may use any resource ID, since it is associated to its family not by its resource ID, but rather by a table in a new resource, the 'FOND'. The 'FOND', which stores size-independent family information, contains a family name and a font association table (Inside Macintosh, IV-39) with entries for each 'FONT' or 'NFNT' resource in its family. Each font association table entry includes a word to hold a specific font's point size, a word for its style, and a word for its associated 'FONT' or 'NFNT' resource ID. Since font families were now identified by a 'FOND' ID, not by eight bits in a 'FONT' ID, the range of font family IDs was expanded to 0 through 32,767.

The addition of outline font support saw the introduction of the 'sfnt' resource, whose internal format differs substantially from the older font data resources ('FONT' and 'NFNT') and is documented in The TrueType Font Format Specification, APDA catalog number M0825LL/A. As with the 'FONT' and 'NFNT' resource types, the 'sfnt' is grouped into a font family by an entry in the font association table of the 'FOND'; such an entry always has a listed point size of zero.

Back to top

Scripts and their Ranges

As stated in the introduction, each script interface system that can run on the Macintosh has a range of font family IDs assigned to it. A script's range can be calculated (see Macintosh Technical Note #242, "Fonts and the Script Manager"), but a table of scripts, their script IDs, and the range of font family IDs assigned to each script are provided in this Note.

font family id table

  • Font family IDs 0 to 1 are reserved. The system always maps the correct system font to font 0 and the correct application font to font 1. On a Roman system, Chicago is the system font and Geneva is the application font. Obviously this is not true on the Kanji system or any other non-Roman script interface system (see Technical Note #242, Fonts and the Script Manager for more details on how various script systems map fonts to font family 0).

Back to top

Breakdown of the Roman Script Range

The 16,384 IDs available for Roman systems are further delimited as follows:

0 to 255 Font families which are named in the method described in Inside Macintosh, Volume 1, The Font Manager. These IDs should no longer be used. Please note that Apple's system fonts (e.g., Chicago, Geneva, New York, etc.) will always retain their old IDs. Also note that IDs 0 and 1 are especially inviolate, as the system has the right to map any font family from any script system to these IDs.

256 to 1023 Reserved numbers. These numbers should be thought of as reserved space that the Font/DA Mover can use to resolve past and future font ID conflicts. Numbers in this range should not be used as a font family's original ID.

1024 to 16382 Commercial fonts. A particular Roman font family should always fall somewhere in this range, though its exact position may vary, or be altered during the copying of fonts, to avoid conflict with other families.

16383 Reserved. This number should not be used.

On non-Roman script systems, the system font in that script will be ID 0. On such systems, Chicago is mapped to 16383 rather than 0; the system software will always look at 16383 rather than 0 for Chicago in these cases.

Developers who use a font as a method of storing symbols which are used in a palette, or store a font in the resource fork of their application for some other special purpose, should use numbers in the range 32,256-32,767. This range is not associated with any script.

Back to top

The History of Font Registration

Obviously, there are a lot more font family IDs available for Roman systems than for any other. This situation is fortunate, because there are a lot more fonts designed and sold for Roman languages than for any other. In fact, today there are many more fonts than unique font family IDs, and so many families may be using the same ID, causing potential conflicts among them.

In an attempt to alleviate the 'FOND' ID conflict problem, Macintosh Developer Technical Support implemented a font registration program in early 1989. The registration program provided ID numbers only to those font families which were entirely composed of 'NFNT' resources. Families which consisted of 'FONT' resources and 'NFNT' resources were not registered.

As of late 1990, all free font family IDs had been registered, so any new font families created after that time must share their ID with a registered family; Developer Technical Support no longer registers family IDs.

Back to top

Ask For It by Name

The paucity of unique 'FOND' IDs is not as catastrophic as it sounds. Since April 2, 1988 (See Macintosh Technical Note #191, "Font Names"), Apple Computer has recommended that developers make all references to font families by name, not number. With that document's description of how to store font information by name in applications and documents, the only remaining major hurdle to 'FOND' ID independence was that the 'PICT' resource still identified fonts by family number; with System 6.0.5, however, a new 'PICT' opcode was added to allow 'PICT's to reference font data by 'FOND' name.

As of this writing, nearly all major applications identify families by name, and since Font/DA Mover and System 7.0 renumber conflicting families when copying fonts, there should never be confusion except when using newer fonts on old software which references by number.

Back to top

Notes on the Location of Font Resources

Certain restrictions apply when storing font resources in an application's resource fork. Due to the order of preference with which the font manager looks for font resources, you should make sure your application font does not use the same name as any system font resource. Otherwise, the system may unexpectedly or intermittently choose the system's version of the font over yours, particularly under System 7.

Fonts should never be stored in a document's resource fork. If you close a font-laden document, the system will retain references to memory which was deallocated when the document closed; the system could then alter memory at those locations and corrupt the heap. In addition, System 7 does not support the storing of fonts in document resources. Note that HyperCard stacks are documents. If you feel that your stack loses all its artistic merit without a certain font, you should license it for distribution in a suitcase file and let the users install it in their systems.

Fonts are proprietary; to include unlicensed fonts with your application violates copyright laws. Contact a font developer for permission before releasing its fonts with your software.

Back to top

References

Inside Macintosh, Volume I, The Font Manager

Inside Macintosh, Volume IV, The Font Manager

Inside Macintosh, Volume VI, The Font Manager

Technical Note M.IM.FontNames -- Font Names

Technical Note M.TE.FontsAndScripts -- Fonts and the Script Manager

The TrueType Font Format Specification, APDA catalog number M0825LL/A.

MacPaint is a registered trademark of Claris Corporation.

Back to top

Change History

Add this section if there are changes. If you're writing a new technote, then you can remove this section.

01-August-1990

Originally written.

01-March-1991

Apple Computer no longer registers font family ID numbers; this note has been altered to reflect the change in policy. Also, the relationship of outline fonts to font families is discussed briefly.


Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (176K).

Download