Adding Position Effects


Introduction

QuickDraw GX allows fonts to contain several varieties of position adjustment.

All these things interact and cumulate to do what you want. More and more, you're putting the intelligence into the font so it doesn't have to be in the user. What happens when tracked text, fully justified, comes to the end of a line and there's a contextual kerning set which includes hanging punctuation? The short answer: It does what you want.

 

Tables covered in this chapter

Table Tag

Contents

just

justification table

kern

kerning table

name

names

opbd

optical bounds table

prop

glyph properties

trak

tracking table

Kerning

The basic spacing information in a font, in the form of left and right side bearings for each glyph (or top and bottom in the case of a vertical script), is necessarily a compromise. Certain pairs of glyphs will be too close or too far apart; collisions occur even between glyphs separated by another glyph; and glyphs with different sizes and shapes will not align nicely at the edges of the text.

GX fonts can contain all varieties of this prescriptive spacing information, and both optical bounds and kerning take full advantage of glyph classes (kerning even in two different ways!) to make the process speedy.

Note, however, that optical bounds is, strictly speaking, a separate table. It is likely to appear in different parts of an application's user interface from kerning, etc.

However, kerning and optical bounds are linked in that they are positionally-absolute, glyph-specific "correctives" to the font's basic metrics. If the font has them, GX will use them by default, and it is very rare that the user will go to the trouble of turning them off (even after finding the interface to do so!).

Thus, this step of creating a GX font is a direct follow-on from setting the basic spacing.

Kerning values are proportionally adjusted by point size, tracking value, justification factors, and (with additional information) style variations. You can add specific information to determine what happens under style variations. The only sane way to think about kerning is to set kerning for the "ideal" case of the font ignoring tracking and justification effects: if the other effects are set up properly, the spacing will take care of itself, and besides, well over 90% of the time a font is used in its basic state without any fancy spacing or variations.

Note that kerning is processed after glyph effects, so you get to kern all your small caps and swashes, too.

What to kern

Extensive tracking and kerning information is required to provide high-quality, properly-spaced results over a wide range of point sizes and character combinations. The following is an incomplete list of kerning pair suites that should be included in a font:

  1. Caps to Caps
  2. Caps to Common Punctuation
    . , : ; ! ? &
  3. Caps to Capital Punctuation
    ( ) [ ] { }
  4. Caps to Lowercase Punctuation
    ( ) [ ] { }
  5. Caps to Lowercase
  6. Caps to Small Cap
  7. Lowercase to Lowercase including punctuation
  8. Small Cap to Small Cap including alternates
  9. Small Cap to Common Punctuation
    . , : ; -
  10. Small Cap to Lowercase Punctuation
    ( ) [ ] { } ! ? &
  11. Small Cap to Small Cap Punctuation
    ( ) [ ] { } ! ? &
  12. Swash Caps to Caps
  13. Swash Caps to Swash Caps
  14. Swash Caps to Lowercase
  15. Swash Caps to Small Cap
  16. Swash Caps to Common Punctuation
    . , : ; ! ?
  17. Swash Caps to Capital Punctuation
    ( ) [ ] { }
  18. Swash Caps to Lowercase Punctuation
    ( )[ ] { }
  19. Old Style Figures to Old Style Figs and Common Punctuation -
    . , : ; ! ? &
  20. Old Style Figures to Lowercase Punctuation and Monetary -
    ( ) [ ] { } $ cents, pound, yen, florin, etc.
  21. Old Style Figs to Small Cap Punctuation and Monetary -
    ( ) [ ] { } $ cents, pound, yen, florin, etc.
  22. Lining Figures to Lining Figures including Capital Punctuation and Monetary
  23. Fractions

Kinds of Kerning

Kerning information in a QuickDraw GX font can take three forms:

In choosing one (or more) of these kinds of kerning to include in a font, the real deciding factor is what's easiest for you, the font developer, to work with.

Kerning can also operate in two directions: the direction the font is rendered, called with-stream kerning; and the perpendicular direction, called cross-stream kerning.

Combining kerning types

A font can contain one, two, or all three of the varieties of kerning. All of these things are cumulative. There's no ambiguity to what will happen, because kerning is strictly addition or subtraction of space; you just add all the kerning adjustments together to get the final result.

Approaches

If you are creating the first-ever kerning data for a font, it is best to develop a class-based kerning strategy, and implement the class-based kerning tables before the regular kerning pairs as this will dramatically cut down the amount of work required. If you've made thousands of kerning pairs already, however, you might want to use "Add As..." (see later).

Adding a kern table

To create a new table in the main window, select "New..." or type Command-N. A dialog box will appear, featuring a pop-up menu which lists all of Line Layout's pre-defined tables. Scroll down to the tag entry "kerning" and select it.

The following dialog box appears, asking what type of table to create. Select "Create dummy table", and press OK:


A TrueEdit bug shows the "Data in the 'FOND'" to be enabled, when it cannot in fact be selected.


The tag abbreviation for this table is kern, which will now be added to the list of tables in TrueEdit's main window.

Adding kerning data

Double-click on the tag kern in the main table window to open the Kerning Table. This window will be empty the first time it's opened.

The Tuple Index column is for use with style variations, and can be ignored for the moment.

Importing kerning data

On selecting "Import", you will be asked whether you want to import old data and/or update the data's format. The new format doesn't change any of the kerning data; it was only necessary to overcome a potential misinterpretation of data between Microsoft's and Apple's TrueType fonts.

The Kerning List Window

When applying kerning to a font with variations, the "Tuple Index" column is

 


Because of a TrueEdit bug, when you double-click these, nothing happens. Instead, you have to select Open from the file menu to get to the Edit Window.

The Edit Kerning Window

The same edit window is shared by all kerning types:

All kerning values are specified in font units: the number of subdivisions of the font's em-square. Thus, kerns are relative to the point size of the font, and have nothing to do with the advance widths and side bearings of the glyphs involved.

The value editable field at the top of the window allows you to directly enter the kerning value for a given pair. Negative kerning values indicate that the right-hand glyph is moved left; positive values indicate right movement.

The scrollbar at the right of the display is used to select kerning sets. Scroll down to edit the next pair.

The two scrollbars underneath the display are used in Class-based Kerning (see below) to scroll through the left-hand and right-hand glyphs in a kerning class, so that the kerning can be verified for each glyph in the class.

The M-shaped line at the bottom of the display is used to select different pairs of glyphs for adjustment when editing contextual kerning. To select a pair of glyphs, drag the marker line so that it spans the pair. If a pair is not selected, it cannot be edited.

To change the kerning value for a pair of glyphs, drag the marker line so that it spans the two glyphs to be adjusted, and then drag the right-hand glyph until it looks okay.

Alternatively, TrueEdit's kerning table makes use of several hidden Command keys. These attempt to make it easier to edit kerning without using the mouse:

Command-key

Function

Shift-K
Shift-O

Change kerning value by one font unit.

Shift-K
Shift-O

Change kerning value by ten font units

i
m

Change the right-hand glyph to previous or next glyph

Option-i
Option-m

Change the left-hand glyph to previous or next glyph

Text rendering is always left-to-right, so all these features work just fine for Hebrew and Arabic, too.

 

Since all kerning types share the same editing window, only the list window will be dealt with for each type.

Pair Kerning

Pair kerning is the simplest form of kerning available in TrueEdit. If you are adding kerning to a font for the first time, it is recommended that you use Class-based Kerning to cover most situations, and then use Pair Kerning and Contextual Kerning to cover the special cases.

Add

When you add a kern table, the Pair Kerning subtable is automatically included. To edit this, double click its entry in the "Kern Table" window. The Kerning List appears:

The list is an ordered list, sorted first by the first glyph in the pair (by glyph number), then within those groups by the second glyph in the pair.

To add pairs to the kerning list, type Command-A, or choose "Add Entry..." from the Edit window. The "Add Kerning Pair" dialog box should appear:

Type the characters for the left-hand and right-hand glyphs into the "Left" and "Right" fields, and select OK. Alternatively, if you select the "Add pairs as glyph indices" box, you can specify the left and right-hand glyphs by their indices within the glyph table (as shown beside each glyph in the Glyph Palette).

If a pair doesn't immediately "take", scroll to another glyph or pair and scroll back. The correct kerning value is displayed and you can edit it. This only happens, apparently, if you're working on the last two glyphs in the window and add a new kerning pair for them (not when you're editing a previously-existing pair).

Double-click a kerning pair (in the Kerning List window), or choose the Edit Entry... menu item to get the standard kerning editing window.

When you double-click a kern pair to open the editor window, the selection range is indicated in -gray-, not black. If you drag a glyph from the palette onto the selection when it's gray, TrueEdit crashes instantly, and all your work is lost.

Using Classes

In a TrueEdit Class Table ('clas'), glyphs can be grouped together and named according to the logic of the font designer. These classes can then be accessed in the Kerning table.

This is useful with kerning tables, because a designer can develop a partial kerning table, and then create the classes afterwards. Note that this is entirely different from class-based kerning, in which the classes are created first and the kerning added later

To use classes in the Kerning table...

  1. Double-click on the 'kern' table in the main menu.
  2. Type Command-A to open the kerning pair editing dialog box.
  3. If you wish to select one of the glyph classes you created in the 'clas' table, Click on the Add As button. This will open another dialog box in which you specify the class and identify one character or glyph that will have the same kerning value on the right or left side.
  4. Click on the pop-up menu to reveal all the classes from the 'clas' subtable. Choose one of the named classes.
  5. Next, define one glyph to which glyphs in the named class share similar kerning values. In the smaller rectangle, type in that character (if it's accessible from the keyboard) or the glyph number. Identify whether you are using character or glyph number by one or the other checkbox.
  6. Finally, select whether the glyph kerning value should be used for the left or right side of the glyph.
  7. When these three entries are defined, Click OK in the "Add As" kerning dialog box. Then, click OK in the regular kerning dialog box.

    TrueEdit crashes instantly if you try to Add As... without a 'clas' table defined.

Class-based Kerning

Many glyphs in a font share the same kerning characteristics: for instance, every plain letter a in the font kerns the same way, regardless of any accent over it. By allowing you to group such similar letters together into classes, and then only specify kerning between such classes, TrueEdit allows you to greatly speed up the process of adding kerning to a font.

If you are creating the first-ever kerning data for a font, it is best to develop a class-based kerning strategy, and implement the class-based kerning tables before the regular kerning pairs.

Note that class-based kerning is supported by a source table which is used only within TrueEdit. While it is a good idea to strip this table before shipping the font, you should always keep a copy of the font with this table still in it - otherwise, you won't be able to edit the class kerning tables later with TrueEdit.

Here is a step-by-step guide to creating a class-based kerning table from scratch:

Adding class-based Kerning

Type Command-A to add a subtable format to the Kern Table. A window will appear, whose label will instruct you to "Create Kern Subtable". To create a Class Based kerning subtable, click on the radio button next to that choice. Hit OK. The Kern Table window will update to reflect this new table.

Type Command-T or double-click on the new subtable format, "Class Based", to open up its subtable editing window. The window is divided up into several sections whose purposes are described in the following text

The top portion of the window is used to edit the classes used in kerning. This is further subdivided into two editors: the left-hand section is used to edit a "left side of pair" kerning class, while the right-hand section is used to edit a "right side of pair" class.

Add Class

Click the mouse in the upper left column in the horizontal box next to the menu icon, and type a name for this left-hand class. When you press return, TrueEdit presents a dialog similar to that below (where "T Left" had been entered):

To add a class, leave the "Add..." option selected, and hit OK. If you need to rename the class later, enter a new name for it on the Kerning Class window, hit return, and when the dialog appears, select "Rename..." instead of "Add".

The same steps are used to create right-hand classes.

Defining Classes

To add glyphs to a kerning class:

After glyphs have been assigned to a class, the accompanying scroll bar becomes active. To replace a glyph already in a class with another from the glyph palette, drag the new glyph in over the existing glyph. If you wish to add new glyphs, scroll down to the last empty box in the column.

If you wish to delete glyphs from the set, select the glyph(s) and choose Clear from the Edit Menu, or use the Delete key.

You can't copy glyphs between classes.
Each glyph can belong to at most one left-side class and one right-side class.

Clicking the menu icon beside the class's name allows you to select another class to be edited from a popup menu.

Creating class-based kerns

After you have created at least one left-hand class and one right-hand class, you can connect the two classes together and assign a kerning value to that pair of classes.

The lower portion of the Kerning Class window contains a list of class-based kerning rules.This section is divided into three columns: Left Class, Right Class and Value.

Command-click on the leftmost blank entry in the Left Class column. Select one of the left-hand classes defined above. Then, do the same in the first entry in the Right Class column, and select the class of glyphs you want to pair with the chosen Left Class entry.

After selecting the two groups (a left-side group and a right-side group), you can edit the classes' kerning value by double-clicking their entry in the kerning list.

Initially, the editor window will show the first entry of each group in a pair. You can click on the right glyph, and drag it around to set the kerning values visually. To test this kerning value with other glyphs in either the left-hand or right-hand classes, use the two horizontal scroll bars (underneath the display) to scroll trough each glyph in the left-hand or right-hand class.

As you drag the glyphs around, the kerning value will update, and is reflected in a box at the top center of this window.

Contextual Kerning

Contextual kerning is used to fix situations such as illustrated below, where the application of two kerning pairs (F and full-stop, full-stop and close-quote) causes a collision between two glyphs (the F and close-quote).

To avoid this situation, a contextual kerning rule is inserted into the font which will apply one or other of the two kernings above, but never both together.

Note this is not intended to take care of colliding swashes; that's already handled by the mort table.
Also remember that the kerning is cumulative: you should do contextual kerning last, to correct problems that the other kinds can't handle.

Add context

From the main kerning winow, add a "State-Based" kerning table.

Edit context

The editor is very similar to a mort table editor. Drag in the sequence of glyphs you want to deal with.

[Sticky!]

Edit kerning

The editor shows the whole set of glyphs. You can drag any glyph to reposition it within the sequence.

Optical Bounds

The optical bounds table in the font contains values which represent a glyph shape's visual edge, rather than its actual boundaries. These values are considered only at the edges of a line, not at points within a line of text. With information provided by the font designer, this table will automatically make fine adjustments to the edges of text in order to make line edges align optically, which results in better colour and improved legibility.

In a Roman typeface, the adjustments can be applied to the left edge of a run of text or, for fully justified text, to the right side of a margin. Because rendering of a font is always left-to-right, optical bounds can easily be applied to right-to-left scripts too (and vertical text)

Optical bounds are not proportionally adjusted for anything but point size; they determine the absolute optical edge of the line (which hanging punctuation will hang over). Kerning, tracking, and justification all work relative to the optical bound you define.

The optical bounds table allows specification of bounds by use of control points. The control point designates the position within the glyph that should be aligned to the given edge of the line of text. This has the advantage that it allows the optical bounds of a font to be affected by instructing.

Control point numbers are specified for the left-side, top, right, and bottom optical edges for each glyph having optical edges in the font. You can specify points for 1, 2, 3, or all 4 bounds. This allows the optical bounds of a font to be correct even after the font has been instructed, because the instruction will affect the control point for optical bounds too.

The optical bounds table can be either distance- or control-point-based, but not both.

Control point specification of optical bounds is not implemented in TrueEdit.


The optical bounds editor includes a list window and an editing window. Command-T or double-click on the opbd table to open the "List opbd" subtable. This is a list of every glyph in the font, with each glyph image referenced by its index number.

Double-click on a glyph from the list in the "List opbd" window, to open the "Edit opbd" editing window. This dynamic editing window is scrolling and resizeable.

The selected glyph will appear by default on the left of the window, next to a vertical line. This vertical line represents a left margin. The selected glyph is bracketed on either side by missing character glyphs, which are temporary placeholders which can be changed to any glyph in the font. The selected glyph is always displayed in the context of two others, regardless of the margin's orientation.

A small bitmap of the selected glyph will appear in the top center of the window. On the upper left is the "Bounds" box, a pop-up which defaults to the "Left" margin. On the upper right is the optical bounds "Value" editing box, where new optical bounds values can be entered directly. As in other TrueEdit tables, both the selected glyph and the bracketing glyphs can be overwritten by dragging glyphs in from the glyph palette.

To choose a different bracketing glyph, select a glyph from the glyph palette, then drag and drop it over the bracketing glyph. The new one will appear in its place.

The selected glyph can also be changed to another by dragging in a glyph from the palette. Or, use the scroll bar to run through the entire glyph set until you find the one you want. Editing optical bounds New optical bounds can be defined for any glyph, for any or all of the four edges of a glyph: Left, Right, (and for vertical text) Top, and Bottom.

In the upper left corner of the title bar of the "Edit opbd" window is a pop-up menu labeled "Bounds." It lists the four possible margins. As you select each of these boundaries, the orientation of the glyphs and the margin line in the editing window changes to support editing the glyph relative to the new bounds. New optical bounds values can be entered directly in to the box on the right side of the title bar and pressing Return. Or you can edit a glyph's optical bounds by clicking on the glyph in the window, and dragging it with respect to any of the four margins.

The sign conventions are potentially confusing. In the font format negative always means the glyph should be moved left or down, positive means it should be moved right or up. Thus if an O is too far in from the margin on the left side, you would give it a negative bound on the left to move it out towards the margin. If it is too far in on the right, however, you would give it a positive bound on the right.

Bugs and assorted oddities

Optical Bounds using Glyph Classes

You may now specify any number of classes for each of the four directions. Within a class belonging to a particular direction, all of the glyphs have the same 'opbd' value for that direction. This should work properly whether or not you have clases defined. Adding a glyph to an opbd class causes that glyph to take on the 'opbd' value(s) of that class. If the 'opbd' list or editor windows are open, they will then be updated.

Glyph classes are defined and created in the clas table. This table allows you to group together glyphs which share similar features. For example, the letter f and all f-ligatures have the same shape on the left side, so they will have the same left-side kerning value and optical edge value on the left side. See Chapter II for more details about glyph classes.

Click the "Class" button in the subtitle bar of the opbd list to select a glyph class from within the opbd table. This will bring up the "opbd classes" window of the font. The first time you access the classes information from within the optical bounds table, the window is empty except for the "Bounds" selection box.

Click the selection box to choose a boundary: Left, Right, Top or Bottom.

If you wish to use the "f-class" defined above, choose the left boundary, since the feature these glyphs share is the left side.

Within a single direction, one glyph cannot exist in more than one class.


Command-A will open the "Add Optical Bounds Class" window. A pop-up menu shows the first of all the classes created in the clas table. When you click on this menu, it shows all the classes which have been defined. Drag down to the class you wish to add to the optical bounds data base. Click OK. Your choice will now appear in the "opbd classes" window.

Now edit one of the glyphs from the class you just added to the opbd classes list, from within the "Edit opbd" window. To get there, go back to the "List opbd" window, and Double-Click on any glyph within the class you just added to the "opbd classes" window.

As you edit optical bounds values for one glyph in the class, the other glyphs in the class will update automatically. A bullet will appear at the end of the row for every glyph in the class, to indicate that it derives its value from the class.

Watch out when altering classes which have already been assigned optical bounds values in the opbd table.


The relationship between TrueEdit's Glyph Class Table and the Optical Bounds Table is not bug-free. If you add a glyph to a class which has been assigned an optical bounds value from within the Optical Bounds Table, TrueEdit incompletely updates the optical bounds table to reflect the addition of that glyph. Although the bullet will still indicate that the glyph is part of a class, the table does not update the values assigned to that glyph class.

If you close and reopen the font, and then make a change to the value of a glyph within the class, the table will update every glyph in the class, including the added glyphs. You can then change the value back to the original value, and TrueEdit will re-update every glyph in the class.

Tracking

Tracking, in GX terms, refers to changes in letterspacing dependent on the point size of the text and another quantity known as the track number. The default track number is 0 ("Normal"), but you may wish to still specify data for this track, for example to tighten up spacing at large point sizes or amplify spacing at small sizes.

Tracking values add or subtract space based on the point size and the track number. Thus, the spacing values arrived at through tracking are just added onto those resulting from kerning. The starting location of each glyph is shifted left or right by an additional amount.

Tracking Model

Tracking can be thought of as a number of plots on a two-dimensional graph (point size vs. space to add/remove), each plot being a separate track:

Note that GX can also extrapolate tracks: the "Normal", "Tight" and "Very Tight" tracks all remove more and more space from between glyphs at sizes over 48 points. This happens because GX uses the last two points available for these tracks to extrapolate any other tracking values it needs.

To prevent this extrapolation, you should "tie-off" the tracks by putting two spacing values the same at either end, as illustrated by the "small" end of all the tracks (extrapolation occurs at both ends!), and the "big" end of the "Loose" and "Very Loose" tracks.

The "Normal" track is normally the default, but as the example above shows,"normal" does not have to mean "never change the spacing" - in many cases it is still necessary to loosen text at small sizes and tighten it up at larger sizes.

As well as its set of spacing values, each track is also assigned a tracking value, describing how tight or loose it is. The Normal track is usually assigned a value of zero, tighter tracks have negative values, looser tracks have positive values.

The values assigned to tracks have no real meaning in themselves: what is important is their relationship to other tracks' values, GX uses the tracking values for each track to interpolate between tracks, and to extrapolate tracks (based on the trend set by the two largest-valued tracks).

To summarise, interpolation happens:

and extrapolation occurs:

What this means is that even though you enter a very small number of discrete points, you're actually defining a huge space where the font operates.

Tracking values and names

Tracks have names, tracking values, and other attributes, one or more of which may be shown in the application's user interface. To get the intended behavior out of the font, you should understand that these things relate to each other.

You can't add and name an unlimited number of tracks in TrueEdit: you are limited to the five pre-defined tracks.

The user will have fairly direct access to any named tracks. "Tight" and "Loose" will replace "Condensed" and "Extended" from old QuickDraw in the menus (although not directly, since the menus themselves have been rearranged).

Editing Tracks

The 'trak' table is displayed in a list window as shown below:

Note that separate tracks exist for vertical and horizontal text. To switch between these, choose one or other of the "Horizontal" and "Vertical" radio-buttons.

Adding a track

Any font with a trak table must have at least one track. Choose "Add Entry" from the Edit menu to add this track:

Because of extrapolation you really ought to have one zero, one positive, and one negative track. They should be at tracking values +1, 0, and -1.

Adding a size

When you double-click the entry for a track on the "Kerning tracks" window, that track's set of points is displayed.

Initially there will be only one entry here. To add a new point-size to the track, choose "Add Entry" from the Edit menu.

You must have at least two sizes on each track, in order to establish a trend.

To change the tracking value at a given point size, double-click on its entry, or select "Edit Entry" instead.

TrueEdit forces all tracks to have the same point size entries.

[Sticky!]

Justification

QuickDraw GX defines the process of justifying text in somewhat different terms than a typographer might be used to. What happens is the user chooses and alignment (left, right, or center) and a percentage of the whitespace to fill using justification. (100% fill is thus fully justified text, no matter what the alignment.)

Where GX puts the extra whitespace when justifying text is something that the font itself, and not GX, decides.

Justification is also different from other position effects, in that it does not specify one particular behaviour, but rather sets guidelines for a wide range of possible behaviours. Each glyph in the font is assigned various characteristics that control how that glyph behaves during the process of justifying a line of text.

Justification is probably the single most complex part of TrueType GX. Even though TrueEdit's editor doesn't allow access to many parts of GX's justification model, it will still help to understand the big picture.

Priority Levels

There are four priority levels used to define justification:

  1. kashida
  2. whitespace
  3. intercharacter
  4. null.

Bear in mind that these are just names, reflecting the most common uses for the priority levels: you can use the four levels in your font however you see fit. The highest value is kashida priority, followed by whitespace, intercharacter, and finally the lowest priority ("null" priority).

Glyphs at a higher priority have space added or removed (up to their limits, see below), before any glyphs at lower priorities are touched. This means that any glyphs that should participate early in the justification process should be given higher priorities.

For example, because whitespace is a higher priority than intercharacter, justifying lines of text will usually only affect the whitespace glyphs on the line, leaving the intercharacter spacing alone. Only when GX would otherwise have to insert too much whitespace does it begin to insert intercharacter space.

You have a lot of flexibility in assigning these priorities to glyphs. The simplest way is to always associate a glyph with a single priority and set of values. However, if you want more flexibility, a state table can be specified to give glyphs different priorities and factors in different context - but not in TrueEdit, unfortunately.

Factors

The factor associated with a glyph is a measure of how much space it can have added to, or removed from, one or both of its sides.

For the most part, when you specify factors in the justification table, you're specifying ems. This translates to points on a 1-point glyph. Thus, for example, if you identify a range of glyphs as permitting the addition of 0.25 on the right-hand side, that means that 40-point versions of those glyphs can have up to 10 points of whitespace (0.25 times 40) added to them.

Numbers you specify for the grow case should be positive, and represent the upper limit on the extra amount of spacing (possibly whitespace, and possibly other effects) that can be added on one or both sides of a glyph or range of glyphs. The two sides of the glyph are separately controllable in GX, but not in TrueEdit 1.0.

Numbers specified for the shrink case should be negative, and represent the amount of spacing that can be removed.

Alternatively, you can specify a glyph as being "unlimited": this means that it will soak up as much space on a line as GX requires it to, without any upper or lower limit.

Post-compensation actions

If a glyph has to adjust its width based on justification, it can actually take a variety of other actions. These (all optional) are called post-compensation actions.

Post-compensation actions include decomposing ligatures, adding and/or replacing of glyphs (with wider forms -- this can only work for line growth), stretching glyphs, and using the ductility axis in a variation font. Except for adding and replacing glyphs, these all work for both grow and shrink cases.

The provision for adding and replacing glyphs allows ligatures to be broken up when a lot of space needs to be inserted on a line, as illustrated below:

Ductility is a term that probably needs some explanation. Basically, ductility is a measure of how "stretched-out" a character is. This is similar to width, but with one important exception: when a font's Ductility is varied, the characters within it become wider (or narrower). However, not all strokes in the character widen or shrink, as they would if the "width" axis were altered instead. This results in a character that takes up more space on a line, without appearing "fatter". The diagram below shows the effect upon a single glyph of changing the ductility setting:

It can be seen that by allowing the ductility of glyphs in a line of text to vary, less whitespace need be inserted in order to justify a line of text, because the glyphs themselves can stretch slightly to fill small spaces. Ductility, like other font variations, is not handled by TrueEdit: instead, the Apple font tool Mutator can be used for adding style variations to fonts.

Post-compensation actions also apply to space added or removed by kerning and tracking. Thus a very loose or tight track could break up a ligature.

Kerning can also turn on ductility. If this could be a bad thing for certain glyphs, you can set the ductility thresholds so that nothing bad happens to those glyphs.

The Justification editor

In TrueEdit's justification table, a typographer assigns glyphs to pre-defined groups (classes), assigns limits to keep the justification machine in check, and creates a hierarchy that establishes the order in which different glyphs are impacted by the machine. Each glyph in the font can be assigned different characteristics that control how that glyph is affected during the process of justifying a line of text.

Adding the table

Before you build the justification ('just') table, you should build the properties ('prop') table, because the 'just' table will access some of its descriptions. The 'prop' table is where you assign and store information (properties) that is associated with each glyph in the font. Properties describe the nature of a glyph: i.e., whether it is a "white space" or "European number" or if it is allowed to hang.

The rules for these properties are described in Unicode Standard Version 1.0: Worldwide Character Encoding, published by Addison Wesley.

Type Command-N in TrueEdit's main window, and create a Justification Table. Its tag name is 'just'.

Command-T or double-click on the 'just' table to open the subtable. You will see eight columns, described below.

The next sections will show you how to edit these things. Changing a range The first column, "Glyph range", will have some ranges already inserted (TrueEdit imported these from the 'prop' table). The numbers in this column are glyph indices.

To edit this information or add new information, double-click any row in the window; a dialog box opens:

Adding a range

Information for a new range can be added by altering the glyph range specified in the dialog. When you Click OK, the previous information is preserved and instead a new row is created with the specified glyph range.

Editing a range

Simply adjust the settings for the range (without changing the "From:" or "To:" values), and click OK. The changes will be applied to the selected range of glyphs.

The information in the window and the dialog is presented in terms of the internal structure of the 'just' table. The following sections give a view from the outside that tells you how to achieve specific effects:

Assigning priorities

Priorities are assigned to each glyph range so that Line Layout can determine the pecking order in which glyphs are affected during justification. Line layout defines four priority levels for justification, which are indicated by the names kashida, whitespace, intercharacter, and null (although you can actually assign glyphs to any priority you want, regardless of its name).

TrueEdit makes the reasonable assumption that, in a Roman font, glyphs which are defined as whitespace should come first in the pecking order, and should be affected first when space needs to be added to, or removed from, a line. In a Roman font, space should be added and subtracted from these glyphs before any other glyph. Within a given priority, there is no hierarchy, and space will be added or subtracted simultaneously to all glyphs at that priority.

Adding or removing space

One column of the justification list window is titled "Unlimited?". This is a short way of asking, "Can unlimited amounts of space be added to, or subtracted from, both sides of the glyph (or glyphs in the prescribed range)?" If you say "yes", then when a line of text is justified, additional space will be added to both sides of the space glyphs until the line is justified, and default intercharacter spacing will not change.

"Grow limit" is the value assigned to a glyph or range of glyphs which is the maximum amount of space that can be added to either side of the glyph. The threshold value is expressed as a fraction of the font em square, and should be a positive value. Equal amounts of space will be added to each side of the glyph until the grow limit threshold is achieved. For example, if the grow limit of glyph 178 is set to .22, then space equal to 22 percent of the em square can be added to EACH side of it. Note that this is relative to the point size, not relative to the width of the glyph or its side bearings.

"Shrink limit" is the value assigned to a glyph or range of glyphs which is the maximum amount of space that can be removed from either side of the glyph. The built-in limit is, naturally, 50 percent, since the space is equally scraped off both sides of the glyph. This is a negative value.

If a glyph range is "Unlimited", its grow and shrink values are meaningless (as long as they're non-zero), but they're still shown in the window and stll preserved in the 'just' table.

Although Line Layout allows the two sides of the glyph to be controlled separately, TrueEdit does not.

Inserting glyphs

If you want the justification process to automatically insert a glyph to fill up the whitespace on a line, this is where you specify it. The editing dialog offers a text box where you can type in the number of the glyph to be added. Normally this would be a kashida glyph: one which is inserted between certain other glyphs in order to fill up any extra whitespace on a line. The name "kashida", incidentally, comes from a type of extension bar used in Arabic typography for just this purpose.

Some font developers prefer to avoid kashida bars, saying they are not desirable in quality typesetting, except in extreme circumstances. In this case, kashida insertion becomes like the insertion of inter-character space: something which should be done only after the insertion of inter-word space, and sparingly at that. Kashidas are occasionally acceptable and desirable, and should probably be included in fonts, but at a lower priority than growth of inter-word space.

Kashidas can happen at any of the 4 priority levels, even null priority (which happens after intercharacter spacing). The names of the priority levels are really not definitive, but rather descriptive. The important thing to remember is that the priority levels are processed in order. Each font can decide whether they're desirable (unlike the Arabic script system, which decides they're always desirable) or not, so season your GX font with kashidas to taste. Because each font does what it wants, this will work smoothly across fonts.

Apart from kashidas, you can specify the addition of a bullet, fleuron or some other decorative glyph between pairs of text glyphs that are being justified wide, purely for visual effect, as shown below:

 

Decomposing ligatures

"Decomposition threshold" is the value assigned to a ligature or range of ligatures which specifies the maximum amount of space that Line Layout can add to each side of a ligature before it will decompose the ligature.

[Sticky!]

Like the threshold limits described earlier, this value is expressed in terms of the font's em square. Thus a value of .02 for an "ff" ligature means that Line Layout must add up to 2% of the em square to each side of the "ff" ligature before it will be allowed to decompose the glyph into two f's.

You get a warning message if a glyph selected for ligature decomposition is not a ligature: TrueEdit will indicate which glyph is the criminal. To decide what glyphs are ligatures, TrueEdit looks in the ligature features in the font's 'mort' table. That's also how it knows what the ligatures decompose into.


[Sticky!]

Note that Line Layout knows the difference between an "fi" typed on the keyboard and one formed as a ligature. It will not decompose the typed glyph.

Stretching glyphs

For a font with stretchable, or ductile, glyphs, the "Ductile Limit" setting specifies how much a particular glyph will be allowed to stretch: this corresponds to the maximum value to be selected on the 'duct' axis.

If you want some glyphs to stretch without ductility (ie., simple widening), and some to refer to duct, give them different Ductility thresholds in the 'just' table.

You could use this feature to implement text that automatically copyfits itself. By specifing a ductile axis of width for regular body text letters, the text will automatically widen itself subtly, within limits which you specify, to justify a line.

What's not implemented

Many kinds of special effects can be specified in the justification table. For example, ligature decomposition can be specified as happening automatically when a certain amount of whitespace gets added (or removed) from around a ligature. When whitespace amounts get too wide, you might want to designate glyphs as ductile (that is, they have a variant axis that changes their widths), stretchable (that is, they can be stretched mechanically), or capable of being substituted with different glyphs to make up some of the gap.

Here's a technical view of what TrueEdit doesn't let you get at:

Also, TrueEdit always uses the pre-defined priority names, which can be misleading (these names are descriptive only).

Both kerning and justification don't have any way to ignore glyphs; for instance, Arabic vowels should be ignored in determining the kerning of two glyphs, but they may well come between the two glyphs. Entering all possibilities of the three-glyph contextual set is hardly elegant. This can be overcome using state-based tables, but not with TrueEdit's current editor.

Here are some examples of the kinds of effects that you could specify if TrueEdit fully supported LineLayout's justification features:

Hanging punctuation

Glyphs at the end of a line can "opt out" of the justification process. This is in the properties table; it's intended for <DFN>hanging punctuation</DFN> but really you could use it for anything at all. Hanging punctuation is a common (in fine typography) effect where small punctuation (commas, quotes, but not exclamation or question marks) is allowed hang over the ends of lines. The effect can be seen in the example below.

The rest of the properties table is discussed in Chapter 5, because it's all about how the font behaves when mixed with other scripts on a line.

Choosing hanging glyphs

Although conventionally only small punctuation should hang, Line Layout will let you hang whatever glyphs you want to off a margin.

Don't hang the space or the Option-space glyphs; GX Line Layout already handles these as special cases.

The following illustration shows the suggested set of hanging glyphs for Roman typography.

[Sticky!]

The left quotes hang both ways to cover (for example) both English and German usage: as the example above shows, German closing quotation is the same as English opening quotation. The right quote must also hang both ways because abbreviations ('cos, 'ere, etc.) might occur at the start of a line.

Hanging punctuation works for vertically-formatted text as well as horizontally: left for horizontal text means top for vertical text; right means bottom (even though this translation makes sense only for Roman/Greek/Cyrillic-using people working with Kanji fonts, and not for Arabic/Farsi/Hebrew-using people working with Kanji fonts).

The Glyph Properties editor

Hanging punctuation is governed by the font's 'prop' (Glyph Properties) table. For each glyph in the font, TrueEdit allows the hanging punctuation to be set up, using the Glyph Properties editor:

All you need to know about to add hanging punctuation are the second and third checkboxes at the top - "Glyph may hang off left/top edge" and "Glyph may hang off right/bottom". Set these as appropriate for each punctuation glyph in the font.

As a hidden extra, if you choose "Edit Entry", you will get a slightly different set of functions:

[Sticky!]


If you're assigning properties to a Roman font, use the "Apply standard Macintosh character set properties" button to apply the standard properties. The default properties don't include hanging punctuation, however.

The main discussion of the 'prop' table is in Chapter V.

Font metrics

[Sticky!]

The "font metrics" table ('fmtx') has been added to allow a font to describe font wide metric values for line spacing and caret angle independent of the values currently used by QuickDraw.

Old QuickDraw reads the values for ascent and descent out of the 'hhea' table directly and scales them by the point size. This means that the font never gets a chance to hint the ascent or descent values. To complicate matters, old QuickDraw also requires all of the glyphs in the font to fit within those heights, and any glyphs that do not are "squashed" to fit. In light of this, most System 7.x fonts ship with values for ascent and descent large enough to ensure that their glyphs are not squashed, even if this means adding more space between lines.

QuickDraw GX no longer requires a font's glyphs to fit within any prescribed band, and therefore does not perform any squashing. However, GX fonts may still want to keep their original line spacing values so that they continue to work in QuickDraw. To accomodate this, the 'fmtx' table is added, providing a second place within a font for the designer to specify its line spacing and caret angle. One other advantage to using the fmtx is that it allows the designer to hint (and apply variations) to the metric values, if so desired.

The Magic Glyph

The diagram below shows the "magic glyph", a non-printing glyph that contains only the eight points shown below. This glyph can be placed anywhere in the font; typically, it is the last glyph in the font, although it does not have to be in any particular position.


The left sidebearing for the magic glyph should be set to be equal to the Vertical After X-coordinate.

The "magic glyph" uses eight points, in no particular order, that are referred to by the 'fmtx' table. This glyph is not mapped to any character, so it never prints.

When seen in a font editing application, such as TrueEdit, the magic glyph will appear to be a random blob, as the points get connected and filled when displayed. This is not a problem, since the end user will never see it, but it may potentially confuse the font designer.


Definitions for the points within the "magic glyph" are as follows:

Point

Description

Horizontal Before

Has a coordinate of (0,+y), where y is the desired ascent, usually a little above the cap height (H O)

Horizonal After

Has a coordinate of (0, -y), where y is the desired descent, usually the bottom of the common glyphs that descend below the baseline (g, y, j)

Horizontal Caret Base

Has a coordinate of (x,0), where x is either positive or negative. This is equivalent to the Caret Offset value in the hhea. For a non-italic font, this will be the same as the Vertical Caret Base point (0,0)

Horizontal Caret Head

Shares the same y-coordinate as the Horizontal Before. Its x-coordinate is set so that the angle between this point and the Horizontal Caret Base is the desired caret angle. For a non-italic font, this will be the same as the Horizontal Before point (0,+y)

Vertical Before

Has the coordinate (+x,0) where x is 1/2 of the desired line spacing when this font is drawn vertically. Vertical Before and Vertical After are opposite each other, the same distance from the 0,0 coordinate

Vertical After

Has the coordinate (-x,0) where x is 1/2 of the desired line spacing when this font is drawn vertically. Vertical Before and Vertical After are opposite each other, the same distance from the 0,0 coordinate. Use the (-x) coordinate for the glyph's left sidebearing

Vertical Caret Base

Will be the coordinate (0,0) for all Apple fonts

Vertical Caret Head

Will be the coordinate (x, 0) where x is the Vertical Before for all Apple fonts

TrueEdit has no way to add the magic glyph to a font

Behavior in use
[Sticky!]

When applicable, the italic angle of the font should be correctly specified. This information is stored in the 'hhea' table, as two components, a rise value (vertical axis) and a run value (horizontal axis).

The resultant caret slope can be viewed most accurately in the TrueEdit 'lcar' table editor. The italic angle should also be used for the value of the slant ('slnt') font descriptor.

The 'lcar' table allows you to define division points inside some or all of the ligatures. This allows you to specify how a ligature is to be divided by an application. Without the ligature caret table specification, an application may use an even split of the ligature which can result in an undesirable ligature division, especially when one component of the ligature glyph is wider than the other. The ligature caret table allows you to correctly specify the split point to ensure that the position of the caret will be correct.

The 'lcar' table can be either distance or control-point based. In both cases, the values represents a position along the baseline through which a subdivision is made orthogonally to the baseline.

The table can't be mixed-format; it must be either all distances or all control points.

The 'hhea' table contains caret slope rise and run, and an offset (which shifts the caret on all glyphs). You can also put a line gap in here, but the one in 'fmtx' takes precedence.

Position verification

Optical test suites should check whether appearance-specific things like opbd, trak, and just give the desired results. These tests would be printed on high- and low-resolution devices, so that instructions can affect the output in cases where spacing is specified by control points.

Note however, that this is not a test of outline integrity - we can assume that the font remains legible across a range of sizes: we're only checking the visual effects of Line Layout table values.

Examples



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