Important: The information in this document is obsolete and should not be used for new development.
Chapter 4 - Font Manager
The Font Manager is a collection of routines and data structures that you can use to manage the fonts your application uses to display and print text. The Font Manager takes care of reading font data from font resources and creating the bitmap images that QuickDraw uses to display text.This chapter describes how your application can use the Font Manager to find specific fonts and to get font display information, such as the size of the letters, the amount of space between letters, and how sizing and spacing change if the user decides to apply a style such as bold or italic. It also describes how the Font Manager keeps track of fonts and font families.
You need to read this chapter if you are designing a font or if your application uses different font families or allows the user to choose from a variety of fonts. Two types
of fonts can be used on the Macintosh computer: bitmapped fonts and TrueType outline fonts. Your application should be able to handle both types. The information in this chapter about outline fonts applies only to TrueType fonts on the Macintosh, and not
to other kinds of outline fonts or to TrueType fonts on any other platform.Almost half of the information in this chapter describes the tables that make up the resources that are used to define fonts on the Macintosh. Unless you are writing an application, such as a font editor, that needs access to these details, you can skip over most of the material in the "The Bitmapped Font ('NFNT') Resource," "The Outline Font ('sfnt') Resource," and "The Font Family ('FOND') Resource" sections of the Reference portion of the chapter.
Before reading this chapter, read the chapter "Introduction to Text on the Macintosh" in this book. General font-related information and programming suggestions are found in the discussion of font handling in that chapter. You should also be familiar with the information in the chapter "QuickDraw Text" in this book. If you are writing a font editor for TrueType fonts, you also need to read the TrueType Font Format Specification, available from APDA.
This chapter begins with an overview of the terminology used throughout
Inside Macintosh to describe fonts and basic Font Manager concepts, including
The chapter then describes
- characters, character codes, and glyphs
- bitmapped and outline fonts
- font families, font names, and font IDs
- system and application font usage
- font measurements such as left-side bearing, advance width, base line, leading,
and kerning
- how font resources are used to store fonts
- how the Font Manager finds the information your application or QuickDraw requests
- how the Font Manager and QuickDraw work together to create or alter glyph bitmaps for displaying and printing
- how to use the Font Manager routines to manipulate information about fonts
- the data structures and font resources used by the Font Manager
Chapter Contents
- About Fonts
- Characters, Character Codes, and Glyphs
- Kinds of Fonts
- Identifying Fonts
- Font Measurements
- About Font Resources
- Font Resource Types
- A Brief History of Font Resource Use
- Font Family IDs
- Restrictions on the Use of 'FONT' Resources
- Font Resource Tables
- About the Font Manager
- How QuickDraw Requests a Font
- How the Font Manager Responds to a Font Request
- How the Font Manager Scales Fonts
- The Scaling Process for a Bitmapped Font
- The Scaling Process for an Outline Font
- How the Font Manager Calculates Glyph Widths
- Synthetic Fonts
- How the Font Manager Renders Outline Fonts
- Using the Font Manager
- Adding Font Sizes and Names to the Menu
- Storing a Font Name in a Document
- Getting Font Measurement Information
- Favoring Outline or Bitmapped Fonts
- Preserving the Shapes of Glyphs
- Using Width Tables
- Getting the System or Application Font ID
- Using Fractional Glyph Widths and Font Scaling
- Font Manager Reference
- Data Structures
- The Font Input Record
- The Font Output Record
- The Global Width Table
- The Font Record
- The Font Family Record
- The Font Association Table Record
- The Family Glyph-Width Table Record
- The Style-Mapping Table Record
- The Font Family Kerning Table Record
- Routines
- Initializing the Font Manager
- Getting Font Information
- Using the Current, System, and Application Fonts
- Getting the Characteristics of a Font
- Enabling Fractional Glyph Widths
- Disabling Font Scaling
- Favoring Outline Fonts Over Bitmapped Fonts
- Scaling Outline Fonts
- Accessing Information About a Font
- Handling Fonts in Memory
- The Bitmapped Font ('NFNT') Resource
- The Font Type Element
- The Offset to the Width/Offset Table
- The Outline Font ('sfnt') Resource
- The Font Directory
- The Character-Code Mapping Table
- The Control-Value Table
- The Font Program Table
- The Glyph Data Table
- The Horizontal Device Metrics Table
- The Font Header Table
- The Horizontal Header Table
- The Horizontal Metrics Table
- The Kerning Table
- The Location Table
- The Maximum Profile Table
- The Font Naming Table
- The PostScript Table
- The Preprogram Table
- The Font Family ('FOND') Resource
- The Font Style Code
- The Font Association Table
- The Offset Table
- The Bounding-Box Table
- The Family Glyph-Width Table
- The Style-Mapping Table
- The Font Family Kerning Table
- Summary of the Font Manager
- Pascal Summary
- Constants
- Data Types
- Routines
- C Summary
- Constants
- Data Types