Contents


Adding Other Tables


Introduction

Not everything you can do with TrueEdit applies to GX fonts, and not every GX effect falls into a neat grouping like glyph effects, position effects, or language and script support. This chapter covers the remaining tasks necessary for your GX font to identify itself and satisfy basic system requirements.

Next is a discussion of additional editors available in TrueEdit which are not relevant to most developers, whether or not you are creating GX fonts, but may come in handy in an emergency.

The final section of the chapter introduces TrueEdit's hex editor, which can be used to edit any table or to add GX effects not supported elsewhere in TrueEdit.

Tables discussed in this chapter

Table Tag

Contents

clas

Glyph class

cvt 

Control value table

fdsc

Font descriptors

hdmx

Horizontal device metrics

head

Font header

hhea

Horizontal header

hmtx

Horizontal metrics

loca

Index to location

maxp

Maximum profile

name

Name

OS/2

OS/2

post

PostScript

TRnn

TrueEdit source tables

This chapter also discusses the FOND resource required for compatibility with non-GX systems.

Font identification

No matter how much time and effort you put into building a font, no font exists alone. Most fonts are part of a larger family; all have to co-exist with other fonts in the same script; and fonts from all scripts must share the Font menu.

Before QuickDraw GX, font families were limited to four styles: regular, bold, italic, and bold italic. GX provides a variety of mechanisms to ensure that fonts and families are presented in the way their designers intended.

Of course, the most obvious way for a font to identify itself is through its name. Although the standard entries in the name table are unchanged under GX, they are now used in a different way. These differences will be visible on the Font and Style menus of any GX application.

Now that each family can have a distinct set of styles, it becomes important to understand how they relate. Font descriptors let each font identify its own style and family relations. Just as the Feature Registry ensures that glyph effects map sensibly from one font to another, the Descriptor Registry, ensures that styles map sensibly from one family to another.

Two other mechanisms for font self-identification--the OS/2 table and the FOND resource--may become important in particular situations.

Family names

The name table is the chief vehicle by which you convey information about your font to applications and end users.

Language and Script Support discussed localizing the name table. This section covers the use of the name table for font family and style identification. GX fonts require new naming conventions, because more style options are available and the style choices are more flexible.

Detailed instructions for editing the name table can be found in Language and Script Support.

Standard strings

The first eight entries in the Name List window are standard strings, required for all TrueType fonts whether they are GX fonts or not.



Some of the standard strings are now directly visible to the end user:

Non-standard strings

Beyond the first eight name strings, TrueEdit assigns name indices dynamically as the font is edited. That means that one font's index for the name of an effect may not be the same as another font's index for the name of the same effect. Fortunately, the name indices do not matter to the world outside the font.

What matters is the name strings themselves. When fonts that are part of the same family support similar effects, it is very important to use the same name (and localizations) for that effect throughout all members of the family.

For instance, do not call an effect "Decorative Caps" in the roman font and "Decorated Caps" in the italic font. The end user will see these effects as closely related, even though they are implemented as separate font files. Their names should show that they are related.

By the same token, distinct effects should have distinct names, whether within a single font or within a font family.

Upgrading an existing font or family

You may be tempted to add "GX" to the end of your font name, to help end users identify your font as one that supports new effects with QuickDraw GX. But if every font developer did that, in a few years an application's Font menu would be full of "GX"s--and you would be adding on another tag to go with the latest font technology....

Apple strongly discourages changing or adding on to a font name solely to distinguish a GX version of the font.


Apple has created guidelines for an application's human interface to GX fonts which make it easy to spot which fonts have additional GX effects, styles, or other capabilities.

Apple is also developing ways for font developers to distinguish their GX fonts in marketing and packaging.

Font descriptors

The font descriptors table (fdsc) stores information about the relationship of a single font to other members of the same font family.

Under GX, font families can incorporate any number of uniquely named styles, from Antique Roman and Demi-Bold Oblique to Ultra-Wiggly. Using TrueType GX style variations, a full range of styles can even be built into a single font file. But what happens when an end user selects text using these unique styles, and chooses a different font family which has a different set of styles?

The font descriptors table (fdsc) exists to resolve such situations. By allowing each font to self-identify the typographic style of its glyphs, font descriptors help the graphics system to find the styles in the end user's new family choice which best match the old styles.

All GX fonts should contain an fdsc table to ensure compatibility with applications that support font family conversions.

Standard descriptors

The fdsc table is simply a list of descriptors, each consisting of a four-letter tag and a numerical value. A font may have any number of descriptors.

The four-letter convention should be familiar; it is the same one used for resource tags and 'sfnt table tags, among many other things on the Macintosh.

Apple has defined a standard set of descriptors to cover the most common typographic styles; these descriptors should be present in every font. Full definitions are included in Appendix B. Additional descriptors can be defined by contacting the address:

fontregistry@applelink.apple.com

nalf Non-alphabetic forms

opsz Optical size

slnt Slant

wdth Width

wght Weight

Adding the table

To add the fdsc table:

  1. Choose New Table from the File menu.
  2. The New Table dialog box appears.

  3. Choose "descriptor" from the popup menu and click OK.

The fdsc table appears in the font's Tables window.

To edit the table, double-click its entry in the Tables window. The Font Descriptor List window appears.

The window is initially empty.

Adding descriptors

To add a descriptor:

  1. Choose Add Entry from the Edit menu. The Edit Font Descriptor dialog box appears.
  2. Type a four-letter tag and a value for the descriptor.
  3. Click OK to accept the new entry, or Cancel to discard it.

As you add descriptors, they appear in the Font Descriptor List window, in the order you added them. The order of entries makes no difference to the operation of the font.

Editing descriptors

To edit an existing descriptor:

  1. Double-click its entry in the Font Descriptor List window.
  2. The same Edit Font Descriptor dialog box appears.
  3. Type a new four-letter tag or a new value for the descriptor.
  4. Click the Next and Prev buttons to scroll through the descriptors in the font without leaving the dialog box.
      Once you click the Next or Prev button, any pending changes to a descriptor are lost. The OK button accepts changes for the current descriptor only.

    This is different from the usual behavior of these buttons.

  5. Click OK to enter the new descriptor tag and/or value in the fdsc table, or click Cancel to leave all entries unchanged.

Managing descriptors

You can't delete individual descriptors from the fdsc table, but you can achieve many of the same results by changing the names and values of existing descriptors. If you must delete a descriptor, it is easy enough to delete the entire table and re-enter it with the correct information.

As simple as editing this table is, a shortcut can make it even simpler. Since the five standard descriptors should be present in every font, you can create one fdsc table with the five standard descriptors, copy and paste it into each font you create, and edit only the values.

OS/2

The OS/2 table (OS/2) stores information required for TrueType compatibility with the OS/2 and Windows operating systems. (Many additional steps may be necessary to create fonts for these platforms.) Most of the values are used for font classification.

Apple has adopted the table for some purposes, chiefly the PANOSE font identification system.

Adding and editing the table

To add the table:

  1. Choose New Table from the File menu.
  2. The New Table dialog box appears.
  3. Choose "OS/2" from the popup menu and click OK.

To edit the table, double-click the OS/2 entry in the Tables window. The Edit OS/2 dialog box comes in two pages. To switch between pages, click the Next Page/Prev Page button at the bottom center of the dialog box.

The following sections outline the contents of the OS/2 table. For further information about the values in this table, see the 'OS/2' table documentation.

Page 1

Page 1 of the Edit OS/2 dialog box concentrates on cross-platform metrics information.



Among the values on Page 1 are:

Page 2

Page 2 of the Edit OS/2 dialog box is mostly used to edit the font's PANOSE classification. Full information on the PANOSE system is available from ElseWare, Inc.

There are two ways to determine the PANOSE classification of a font: make the measurements yourself (according to the instructions available from ElseWare), or send a copy of the font to ElseWare and have them measure it.



In the Edit OS/2 dialog box, the popup menus are in the same order as the PANOSE identifiers: Family is the first identifier, Serif Style is the second, Weight is the third, and so on. The menus use names similar to the official ElseWare classification names for text faces. This is convenient for text faces, but makes setting the classification for a script or decorative face a little awkward. You have to look up the correct classification values, then choose the menu settings to correspond to those values--even though the names on the menus may appear wrong.

Other values on Page 2 include:

The FOND resource

QuickDraw GX allows each font to identify its typographic style with a unique name and a range of descriptors. On systems without GX, family and style name identification depend on the FOND resource within the font file.

For backwards compatibility, all GX fonts should have the appropriate name and style settings in the FOND. When these fonts are used on a non-GX system, the correct name and style (or the closest style available) will display.

TrueEdit does not allow you to edit the FOND resource; use a resource editor such as Apple's ResEdit. Full information on the FOND resource is available in Inside Macintosh and from Apple Developer Support.

System requirements

A few additional steps are required to make the font compatible with the systems and printers where it may be used. For the post and head tables, TrueEdit provides some essential support for both older features and features new with GX. As the final step, you should make sure to remove all traces of your TrueEdit work by deleting unnecessary tables from the shipping version of the font.

PostScript compatibility

The PostScript name table (post) contains glyph names and other information used in rendering the font on PostScript output devices. A post table is required in all TrueType fonts.

The post table is typically provided by outline-creation tools. TrueEdit can automatically build a post table for a Roman font, but provides only a partial editor.

Formats

There are several formats available for the post table:

The behavior of a format 3 font on PostScript output devices is unspecified, except that it should not crash the printer. It may print incorrectly, or may not print at all. In actual practice, fonts with format 3 post tables often print with no trouble.

An additional format, format 2.5, is defined in The TrueType Font Format Specification but is not supported in TrueEdit.

Viewing names

When you open the post table, the PostScript Name List window shows names for all the glyphs in the font.

You cannot add, edit, or delete post entries. This table must contain exactly one entry for each glyph in the font.

Editing other information

To view and edit other information stored in the post table:

  1. choose Get Info from the Edit menu.
  2. The Edit PostScript Table dialog box appears.

The values in the post table are:

Rebuilding the table

Although you cannot use TrueEdit to edit the glyph names in the post table, you can delete the entire table and rebuild it. TrueEdit rebuilds the table automatically.


When you choose New Table on the Edit menu to add a post table, TrueEdit automatically does the following.

  1. Creates a new post table using format 2.
  2. Assigns standard Roman names to glyphs 0-257.
  3. Assigns the other glyphs names of the form glyphnnnnn", where nnnnn is the decimal glyph number.

Font header

The font header table (head) stores basic functional and typographic information for the font; some new functionality has been defined for GX fonts. A head table is required in all TrueType fonts.

You cannot create a new head table in TrueEdit.


The head table is typically automatically built and maintained by outline-creation tools. TrueEdit provides an editor for situations where it is inconvenient to return to the original tool, and for the new functions which may not be supported by third-party tools. If you know exactly what you are doing, you can edit this information directly in TrueEdit.

Apple strongly recommends against editing most head table values in TrueEdit. Correct values in this table are essential to the proper operation of the font.

When you open the head table, the Edit Font Header dialog box appears.


The most significant values in the head table are:

For further information about the values in this table, see The TrueType Font Format Specification.

Stripping excess tables

Before you ship your TrueType GX fonts, remember to strip the TrueEdit source tables (TRnn and clas) and any other information not required for the font to function. A full list of the TrueEdit source tables is included in Appendix C.

Although these tables will not interfere with the function of the font, they can add significantly to its size and its memory demands on the Macintosh and on printers.

Be sure to maintain a copy of the font with all its source tables, for future editing.

Other TrueEdit editors

Although TrueEdit is designed chiefly for adding GX functionality to a TrueType font, it has some support for a few tables which are unchanged for GX:

These tables are usually created and maintained invisibly by font tools which edit outlines and/or instructions.

Apple strongly recommends against editing these tables in TrueEdit. None of them exists independently of other tables in the font, and you can easily create serious functional problems or corrupt font data by adding the wrong information.

Horizontal metrics

TrueType uses three tables to record horizontal metrics for a font:

Ideal metrics

The horizontal metrics table (hmtx) records the left side bearing and advance width of each glyph in the font, expressed in font units. These values are called ideal metrics, because no actual output device will be able to exactly match the values, except under very rare circumstances. Under GX, Line Layout uses the ideal metrics in determining position effects such as justification.

Although TrueType instructions let you work with this information by manipulating points on a glyph outline, it is important to remember that those are "phantom" points. The font's metrics data exist only in the hmtx table. An hmtx table is required in all TrueType fonts.

You cannot create a new hmtx table in TrueEdit.


Horizontal metrics editing is typically well supported and tightly integrated in outline-creation tools. TrueEdit provides a simple graphical editor for situations where it is inconvenient to return to the outline-creation tool and rebuild the entire TrueType font. A basic guide to the editor follows.

  1. Open the hmtx table from the font's Tables window. The Horizontal Metrics List window shows metrics values for all the glyphs in the font.

    You cannot add or delete hmtx entries. This table must contain exactly one entry for each glyph in the font.

  2. Select a glyph to edit, and open the editor by double-clicking the entry or choosing Edit Entry from the Edit menu.
  3. The Horizontal Metrics editor window appears.
  4. The glyph's left side bearing and advance width are shown by solid vertical lines.

     

  5. For reference, the window also shows:
    • The glyph origin
    • The ascent
    • The baseline
    • The descent

    The ascent and descent values are taken from the font's hhea table.

    A section at the top of the window shows the glyph number, the current left side bearing and advance width (in font units), and the number of outline points in the glyph.

  6. To change the glyph's left side bearing, drag the left-hand solid line. To change the glyph's advance width, drag the right-hand solid line.
  7. The values available for graphical editing are limited by the resolution of the Macintosh screen. For more precise editing, enlarge the editor window.
  8. To enter exact values, double-click anywhere within the window, or choose Edit Entry from the Edit menu.
  9. The Edit Metrics dialog box appears.


  10. Type new values in the number fields.
  11. The Next and Prev buttons let you scroll through the glyphs in the font without leaving the dialog box.

    Once you click the Next or Prev button, any pending changes to a glyph's metrics values are entered into the font. The Cancel button cancels changes for the current glyph only.

  12. Click OK to enter the new glyph metrics values in the hdmx table, or click Cancel to leave the current glyph entry unchanged.
  13. To choose a different glyph to edit, use the scrollbar on the right side of the Horizontal Metrics editor window.
  14. You can also drag a single glyph from the glyph palette into the editor window to jump directly to that glyph.

Device metrics

The horizontal device metrics table (hdmx) records integer advance widths on a per-glyph basis for specific pixel-per-em resolutions. These values are called device metrics, because they are typically intended for use on a particular output device, such as the Macintosh screen or a low-resolution printer.

QuickDraw GX does not use a font's hdmx table, but it may be useful to ensure backwards compatibility of a GX font on a non-GX system.

You cannot create a new hdmx table in TrueEdit.


The hdmx table is typically automatically built and maintained by instructing tools. TrueEdit provides an editor for situations where it is inconvenient to return to the instructing tool and rebuild the entire TrueType font. A basic guide to the editor follows.

  1. Open the hdmx table from the font's Tables window.
  2. The Horizontal Device Metrics Size List window shows what pixel-per-em sizes have device metrics information in the font. The maximum pixel width for each size is shown on the right side of the window.


    You cannot add or delete point size entries in the hdmx table.

  3. Select a size to edit, and open the editor by double-clicking the entry or choosing Edit Entry from the Edit menu.
  4. The Horizontal Device Metrics Glyph List window shows integer widths for all the glyphs in the font.


    You cannot add or delete hdmx entries. This table must contain exactly one entry for each glyph in the font.

  5. Select a glyph to edit, and open the editor by double-clicking the entry or choosing Edit Entry from the Edit menu.
  6. The Edit Device Metrics dialog box appears.
  7. Type a new value in the number field.

     

  8. The Next and Prev buttons let you scroll through the glyphs in the font without leaving the dialog box, as they do elsewhere in TrueEdit.

    Once you click the Next or Prev button, any pending changes to a glyph's width are entered into the font. The Cancel button cancels changes for the current glyph only.

  9. Click OK to enter the new glyph width in the hdmx table, or click Cancel to leave the current glyph entry unchanged.

Header

The horizontal header table (hhea) stores basic information required by the graphics system to render a horizontal font. An hhea table is required in all TrueType fonts.

For QuickDraw GX, much of the same information is provided by a font's fmtx table. If your font will be used on a non-GX system, or if it does not include the fmtx table, values in the hhea table may be very important.

You cannot create a new hhea table in TrueEdit.


The hhea table is typically automatically built and maintained by outline-creation tools. TrueEdit provides an editor for situations where it is inconvenient to return to the original tool.

When you open the hhea table, the Edit Horizontal Header dialog box appears.


The most significant values in the hhea table are:

Instruction control values

The control value table (cvt ) stores key measurements and other values for use by a font's instructions.

You cannot create a new cvt  table in TrueEdit.

The cvt  table is typically built and maintained by instructing tools. TrueEdit provides an editor for situations where it is inconvenient to return to the instructing tool and rebuild the entire TrueType font.

Apple strongly recommends against editing control values in TrueEdit. Control values are typically central in determining the behavior of a font's instructions, and small changes can have dramatic effects.


A basic guide to the editor follows.

  1. Open the cvt  table from the font's Tables window.
  2. The Control Value List window shows the control values in the font, listed by their entry number.

    You cannot add or delete entries in the cvt  table.

  3. Select an entry to edit, and open the editor by double-clicking the entry or choosing Edit Entry from the Edit menu.
  4. The Edit Control Value dialog box appears.

  5. Type a new value in the number field.
  6. The Next and Prev buttons let you scroll through the entries in the table without leaving the dialog box.

    Once you click the Next or Prev button, any pending changes to a control value are entered into the font. The Cancel button cancels changes for the current entry only.

  7. Click OK to enter the new value in the cvt  table, or click Cancel to leave the current entry unchanged.

Font structure

TrueEdit's built-in support extends to two more tables which you will probably never need to examine, let alone edit.

Location

The index to location table (loca) contains the offset and size of each glyph's outline and instruction data in the glyf table. A loca table is required in all TrueType fonts.

You cannot create or edit the loca table in TrueEdit.


The loca table is typically automatically built and maintained by outline-creation tools. TrueEdit lets you view the table, but does not provide an editor.

When you open the loca table, the Location List window appears.

Maximum profile

The maximum profile table (maxp) stores basic information used by the graphics system to determine how much memory a font will require in operation. A maxp table is required in all TrueType fonts.

You cannot create a new maxp table in TrueEdit.

The maxp table is typically automatically built and maintained by outline-creation or instructing tools. TrueEdit provides an editor for situations where it is inconvenient to return to the original tool. But unless you know exactly what is wrong, you're much more likely to do harm than good.

Apple strongly recommends against editing the maxp table in TrueEdit. Correct values in this table are essential to the proper operation of the font.

When you open the maxp table, the Edit Maximum Profile dialog box appears.



For information about the values in this table, see The TrueType Font Format Specification.

The hex editor

The full range of capabilities permitted for GX fonts is described in the document QuickDraw GX Font Formats. TrueEdit gives you customized editors for many of these capabilities, but not all.

If you need to add an effect for which TrueEdit doesn't have a customized editor, you need to use the hex editor. With the hex editor, you can create any table the specification allows, and thus access the full power of GX fonts.

Ideas

Here are some examples of capabilities for which you need the hex editor--that is, for which there are no customized editors in TrueEdit 2.0.

Customized editors for these and other capabilities may be added to future versions of TrueEdit. Until then, using the hex editor is the only option.

The hex editor is not for the squeamish: do not even attempt to add or modify effects using the Hex Edtior unless you really know what you're doing. Even then, make a backup first!

Control point table formats

The optical bounds, ligature caret, and baseline tables have variants that use a control point in a designated glyph to specify a position of interest. Thus, for example, you can designate a control point in some glyph as defining the y-coordinate of the hanging baseline, or the optical edge of a particular glyph.

The built-in TrueEdit editors for these tables don't allow you to specify control point values, only distances. To create one of these tables in its control point format you need to use the hex editor.

Ligatures with more than three components

The font format specification allows ligatures formed from up to eight input glyphs, but the built-in TrueEdit editor permits only three. If you have ligatures with more than three components, you need to use the hex editor.

Other lookup formats

Many of the tables in a GX font use lookup tables to find whether a glyph index is covered by the table. These lookup tables can use one of five different formats.

The built-in TrueEdit editors hard-wire the lookup table formats they use, with the result that sometimes a table is much larger than it needs to be. If space is at a premium in your font, you could use the hex editor to create the most compact lookup table format.

Contextual justification

The justification table can identify classes of justification effects based on context--so that, for example, glyphs at the ends of words justify differently than glyphs at the start or in the middle of words. Arabic fonts which use kashidas for justification need exactly this capability.

The built-in editor doesn't let font developers specify the required state information, so you would have to use the hex editor.

Indic-style rearrangement

There are four basic kinds of glyph effect, but the built-in editors in TrueEdit do not support one of them. Rearrangement effects can be used to move glyphs around with respect to one another. They are needed for fonts used for South Asian scripts, such as the Devanagari script used to render Hindi.

Because there is no built-in editor for creating rearrangement effects, you must use the hex editor.

More powerful glyph effects

The font format specification includes information on how to construct arbitrarily powerful state tables for glyph effects. For most fonts, the built-in TrueEdit editors suffice. However, you may be designing a font that requires effects that cannot be expressed easily by the existing editors--for example, pseudo-random selection of letterforms.

Using the hex editor, you can set up glyph effects to substitute glyphs in a pseudo-random manner.

New tables

As the sfnt format evolves, you can use the hex editor to create tables to support newly defined capabilities.

Using the hex editor


The hex editor is flexible, but it cannot guarantee that the tables you construct are correct. It simply inserts your entries into the table. Thus it is very important to know what you're doing before you use the hex editor!

If you use the hex editor to edit a table which you've previously used the built-in editors to construct or modify, you may lose the ability to use the built-in editors on that table in the future.


To open the hex editor, hold down the Option key as you double-click an entry in the font's Tables window.

Even if you don't hold down Option, you will get the hex editor if you open a table whose tag is not recognized by TrueEdit.

The Hex Editor window shows the complete contents of the table in hexadecimal (base 16). The left-hand column shows the byte offsets from the start of the table. You can add, select, and edit the values as usual.

When you close the Hex Editor window, the Tables window updates to reflect the new size of the table.

Summary

This chapter has covered the remaining aspects of developing a GX font:


Contents


Arleigh Movitz (movitz@applelink.apple.com)
Dave Opstad (opstad@apple.com)
Kristian Walsh (walsh.k@euro.apple.com)