ADC Home > Reference Library > Technical Notes > Legacy Documents > Mac OS 9 & Earlier >

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 Height Tables

CONTENTS

This technical note describes how the Font Manager (except in 64K ROMs) calculates height tables for fonts and how you can force recalculation.

[Apr 01 1986]






Introduction

In order to expedite the processing of fonts, the Font Manager (in anything newer than the 64K ROMs) calculates a height table for all of the characters in a font when the font is first loaded into memory. This height table is then appended to the end of the font resource in memory; if some program (such as a font editor) subsequently saves the font, the height table will be saved with the font and will not have to be built again. This is fine for most cases except, for example, when the tables really should be recalculated, such as in a font editor when the ascent and/or descent have changed.

The following is an example of how to eliminate the height table from a font:

    IF (BitAnd(hStrike^^.fontTyp,$1)=1) THEN BEGIN {We have a height table}
       {Truncate the height table}
       SetHandleSize(Handle(hStrike),GetHandleSize(Handle(hStrike)-
                     (2*(hStrike^^.lastChar-hStrike^^.firstChar)+3)));
       {We no longer have a height table so set the flag to indicate that}
       hStrike^^.format := BitAnd(hStrike^^.fontType,$FFFFFFFE);

In MPW C:

    if ((**hStrike).fontType & 0x1 ==1) { /*We have a height table*/
       /*Truncate the height table*/
       SetHandleSize((Handle)hStrike,GetHandleSize((Handle)hStrike)-
                     (2*((**hStrike).lastChar-(**hStrike).firstChar)+3));
       /*We no longer have a height table so set the flag to indicate that*/
       (**hStrike).fontType = (**hStrike).fontType & 0xFFFFFFFE;

where hStrike is a handle to the 'FONT' or 'NFNT' resource (handle to a FontRec).


Note:
After the height table has been eliminated, the modified font should be saved to disk (with ChangedResource and WriteResource) and purged from memory (using ReleaseResource). This is an important step, because the Font Manager does not expect other code to go behind its back removing height tables that it has calculated.


Back to top

References

The Font Manager

The Resource Manager

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (40K).

Download



Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.