RoyalT Font Editor


Contents

About the RoyalT Font Editor
Opening your 'sfnt' document
The menus
Editing Instructions
Component characters
The Preview window
The Instructions window
The Preprogram window
The CVT window
The Text window
The Device window
The Outline window
The Info window
The Alpha window
The Twilight window

Copyright (c)1990,1991,1996 Apple Computer, Inc.




About the RoyalT Font Editor

The RoyalT Font Editor application allows you to create your own new fonts by using a Macintosh computer to edit, manipulate, and apply instructions to glyph outlines, and preview those outlines at different sizes.

To begin, you must translate your present font in the 'sfnt' format employed by the RoyalT Font Editor. Usually you will have to design your own translator, since none are commercially available.

Return to Contents


Opening your 'sfnt' document

Depending on the type of monitors you work with, you may find it useful to open your 'sfnt' with the Option key held down. If you do so, the RoyalT Font Editor will center all the windows on your main screen. You can then move the windows, and the RoyalT Font Editor will remember their placement the next time that document is opened.


Return to Contents

The menus

File Menu

Clicking the close box or choosing Close from the File menu works in the standard way on most of the views. The exception is the Preview view, which, if closed, will cause the entire document to be closed.

The Dump command creates an MPW text file of the contents of the 'sfnt' resource, in groupings with headers:

---- Offset Table

0> Offset 204, Length 180
1> Offset 384, Length 448
2> Offset 832, Length 20
3> Offset 852, Length 146
.
.
.
---- Header

Format 0x10000, Revision 0x0
Checksum 0x80d337ba, Magic# 0x5f0f3cf5
Flags 0x30, UPEM 2048
-- Horizontal Direction
AW max 2079, LSB min -203, RSB min -349
Y: Ascender 2058, Descender -516, LineGap 204
.
.
.
---- Max Profile Table

Points 88
Contours 7
Composite Points 87
Composite Contours 7
.
.
.

The Print command prints the contents of the current window only.



Edit Menu


To enter instructions in the Preprogram, Instructions, CVT, and Outline windows, you can use the Append command to insert entries at the end of a set of instructions. (The keyboard equivalent for Append is Command-D.) When you have to place an instruction between two already existing instructions, select the lower line and use the Insert command (Command-I). This places the new line above the line selected. Pressing Return after entering an instruction does not give you a new instruction line, but it does give you the Edit Instruction mini-window, where you enter the type of instructions, Booleans, and arguments. (See Editing Instructions for more information.)

In the Preview window, the Append command can be used to add glyphs to the 'sfnt' description.

The Find command will try to find the string of alphanumerics that you enter into the Find mini-window. This is useful for finding certain instructions, character element numbers, and Control Value Table entry numbers. The filters allow you to specify what type of information you are looking for. For instance, the point filter, in conjunction with a 16 typed into the Find mini-window, will find instructions that have to do with point 16 on your glyph outline. The same holds true with the CVT (Control Value Table entry numbers) and element (character element numbers) filters. You can only use Find in the Preprogram and Instructions windows. If you check the Global check box, the RoyalT Font Editor will look through all the glyphs in the 'sfnt' to find every occurrence of the data. Command-period will cancel a global find.



Views Menu

This menu contains the names of all the view windows available to you: Preview, Instructions, PreProgram, CVT, Text, Device, Outline, Info, Alpha, FDEF, and Twilight. If you do not have a large enough screen to see all the views at once, this allows you to select one or more views.


SFNT Menu

The Edit command brings up the Edit Instruction mini-window for entering instructions. (See Editing Instructions for more information.)

To see the effect of your instructions on the outline and bitmap at a specific size, use the Recalc command. This redraws the charcter in the Preview window in accordance with the current instructions and writes it to the 'sfnt' resource. However, changes to the 'sfnt' are not saved until you explicitly save it via the Save or Save As commands in the File menu. You can always invalidate Recalcs commands using the Undo command in the Edit menu. Recalc is used by all of the instruction windows (Preprogram, Instructions, and Outline) along with the Info view.

Warning It is always a good idea to use the Recalc command before moving to another window, because switching views will refresh the screen display and the editing you did in the first view will be lost. You cannot edit a number of windows before doing a recalculation; they must be done one at a time.

The Validate SFNT command checks through your 'sfnt' resource description for errors. For example, you may get the message This instruction uses a value not found in the Control Value Table.

The Make SuitCase command puts your 'sfnt' in a resource that can be installed in the system.

Size Menu

The Any Size command allows you to pick any point size not currently available in the Size menu.

If you would like a point size one removed from your current size, you can use the Smaller (Command-[ ) and Larger (Command-] ) commands. For instance, if you are currently working in point size 18 and would like to see point size 17, choose the Smaller command. To see point size 16, choose Smaller again.

Changing the size affects the size of the text being edited in the windows that have lists of instructions, to make reading and editing the instructions easier. For the Preview, Alpha, and Text windows, changing the point size affects the size of the outline being edited.

Return to Contents

Editing Instructions

This is what the Instructions window looks like when you first open the font (which, for this example, is called Testfont), and the glyphs have no instructions.



The Append command from the File menu creates space for new instructions.

The default is Error[ ].



If you double-click on the Error command, you get a blinking cursor associated with text editing. You can then edit the command as you like. You do not have to type the command in uppercase letters; the font editor will take care of this for you.


For commands which do not take Boolean arguments, it is not necessary to include the square brackets. For instance, you can type in the NPUSHB command in this way:


After pressing Return, the font editor enters the correct form of the command as line 0 of the instruction set.


For commands which do take Boolean arguments and interact with the stack, you may find it easier to use the Edit Instruction window, which can be accessed by the Edit command from the SFNT menu or by typing Command-E. You can also get the editing window by pressing Return after appending a new instruction line.





For instance, to enter the command MIAP[0] 2 9:



Clicking the OK button then enters the command as line 1 of the instructions.


And so on.

Return to Contents

Component characters

For building component characters with the RoyalT Font Editor, there are two new instructions which look very much like the ones already presented in the RoyalT Font Format document. In fact, they are not true instructions at all. They are used only by this font editor.

OFFSET sets up the main component of the character, with x and y offsets. ANCHOR joins the two components together at the specified anchor points. An anchor point is a contour on a character that consists only of that point. (Contours are added using the Outline window.)

OFFSET [ B ] a b c
B: Boolean argument.

   If 0, dont round after the offset and potentially lose grid-fitting
   If 1, round after offset and keep grid-fitting

a: Glyph index for the main component
b: x offset (delta for x coordinate)
c: y offset (delta for y coordinate)

ANCHOR [ ] x y z
x: Glyph index for current component
y: Anchor point on the previous component
z: Anchor point on the current component (x)

There can be far more than two components in a component character. However, the components can only be joined together two at a time.

For instance, if you want to have an uppercase A which takes an umlaut, you dont need to come up with a special outline for that character. If the anchor point on the A (which for this example, is at glyph index 34) is on the top of the A at point 11, and the anchor point on the umlaut (glyph index 140) is between the dots at point 8, the two instructions to join these characters would be:

OFFSET [0] 34 0 0

ANCHOR [ ] 140 11 8

There are two other instructions behave just like OFFSET and ANCHOR, except they take a mandatory two-by-two matrix which is used for any special effects (rotation, shrinkage, and so on). The matrix consists of the last four entries in SOFFSET and SANCHOR and is in the form:

	d 		e
	f 		g

SOFFSET [ B ] a b c d e f g
SANCHOR [ ] x y z d e f g


Return to Contents

The Preview window

When you open the RoyalT Font Editor, you see the Preview window. This window can display a character in several ways: as bitmaps with or without outlines; grid-fitted or not; with or without points.



Preview element Description

Ix Shows the fonts glyph index code.
Sz Shows the size at which the font is currently being displayed.
Bits Shows which bits are turned on by the outline at that point size.
GridFit Grid-fits the outline (and the bitmap for that outline, if Bits is turned on) according to the instructions.
Outline Shows the outline for the character.
Points Shows the points for the character, complete with numbers.
Blobs Shows how a printing device might render the character, calculating the spread of ink and toner.
Metrics Turns on the grid you see on the screen when you have a character in the view. This check box toggles the lines displayed around the character in the window. From top to bottom they are: the height of the uppercase H for this font; the height of the lowercase, flat-topped x; the baseline measurement; and the bottom of the lowercase p. The first vertical line is the left side bearing measurement, and the second is the advance width.
Time This gives how many of this character can be grid-fitted per second. Note how drastically the number changes, depending on whether the Grid-fit box has been checked.
Draw (pop-up menu) This is linked to the trace instructions. Arcs will draw the results of MIRP and MDRP instructions, depending on which of the menu items has been selected. Horizontal only draws horizontal moves, vertical only draws vertical moves, and All draws moves in both directions. Current erases the previous one and draws effects of the instruction that is currently being selected in the Instructions view. None does not draw anything. The number of the instruction which is responsible for the arc is included.
List of instructions Instead of typing in certain instructions that you use over and over again, you can save time by choosing them from this list. Click the F with the numbers (the last one on the second line, in the left corner of the Preview window). Pick an instruction in the list. Then go to the outline and click a point. The instruction will then be inserted into the instructions, either at the end, if there are no lines selected, or just before the line you have previously highlighted.



First F character Measures the (x, y) distance between two points, in units per EM (UPEM). (First on the top line)
Second F character Measures the (x, y) distance between two points in pixels. Pixels are always measured in 64 units (063), so the number after the colon is in 64ths. The same measurements apply to the CVT view. (Second on the top line)
Third F character Allows you to move a point and change the curve. (Third on the top line)
Fourth F character Measures the length of a line between two points in UPEM, and it gives you the angle from baseline to that line. (First on the bottom line)
Fifth F character Measures the length of a line between two points in fractional pixels, and it gives you the angle from baseline to that line. (Second on the bottom line)
Sixth F character Allows you to choose points on the curve where you would like to insert instructions. See List of Instructions above. (Third on the bottom line)



To begin working on a character, you simply type the character on the keyboard. The character is shown with bits and outline on, but with no instructions applied to it. For this example, it will be a lowercase b:






Outline without grid-fitting




Outline after grid-fitting





Bits and outline after grid-fitting





Points and outline after grid-fitting



This is an example of how to use the first F (first one on the top line). Beginning at point 17, the mouse was dragged to point 16, leaving a line not visible on the screen (because it follows the path of the curve, which in this case is a straight line). When the cursor touched point 16, the x and y measurements between these two points (in UPEM) appeared in the lower left corner of the outline. No measurements are shown until the cursor has reached an actual point on the curve.



This is an example of how to use the second F. Beginning at point 21, the mouse was dragged to point 27, leaving a line visible on the screen. When the cursor touched point 27, the x and y measurements (in fractional pixels) appeared in the lower left corner of the outline. No measurements are shown until the cursor has reached an actual point on the curve.




This is how the third F works. Note how the outline changed when point 17, which is on the curve, was moved down and to the left. This may give some idea what the bitmap would look like at various point sizes with the points in slightly different places.



This is an example of how to use the fourth F. Beginning at point 17, the mouse was dragged to point 16, leaving a line not visible on the screen (because it follows the path of the curve, which in this case is a straight line). When the cursor touched point 16, the screen displayed the distance between the points (in UPEM) and the angle between the baseline and the line between those two points. No measurements are shown until the cursor has reached an actual point on the curve.




This is an example of how to use the fifth F. Beginning at point 21, the mouse was dragged to point 27, leaving a line visible on the screen. When the cursor touched point 27, the screen displayed the distance between the points (in fractional pixels) and the angle between the baseline and the line between those two points. No measurements are shown until the cursor has reached an actual point on the curve.



Return to Contents

The Instructions window


The Instructions window shows the list of instructions attached to the character being displayed in the Preview window.


The top part of the window gives the current graphics state, both local and global. GridFit, a check box in the Preview window, must be on for the graphics state to appear. The graphics state only becomes visible when an instruction for a particular character, which is shown in the Preview window, has been selected. The values for the graphics state are those before the instruction has taken effect. Once an instruction in this window has been edited, the graphics state disappears until you use the Recalc command from theSFNT menu.

If you have selected an instruction that affects a point, that point blinks in the Preview window.

To see DELTA instructions work, select the line with the DELTA instruction and press the Enter key.

Instructions window Description

Pts These are the reference points [RP1, RP2, RP0].
CEs These are the character element pointers [CE1, CE2, CE0].
R2G State of the Round To Grid variable (possible values go from 0 (round to nearest half grid) to 5 (do no rounding). The default is 1.
Loop A variable used for instructions that are repeated several times.
minD Minimum distance variable.
sWide Single width variable.
FLIP Auto_Flip variable. If Auto_Flip is false, this reads NO FLIP.
Delta B Delta base (used with DELTA instructions).
Delta S Delta shift (used with DELTA instructions).
Proj Current direction of the Projection vector.
Free Current direction of the Freedom vector.
Stack State of the stack, which is automatically built from the instructions provided. See the following diagrams.


Note how the graphics state changes in the sequential views of the Instructions window below. (In particular note the Pts and the Stack.)





Return to Contents

The Preprogram window

The preprogram is typically used to store instructions that modify values in the Control Value Table. When the preprogram is processed, there are no specific characters in memory. The preprogram is executed by the RoyalT Font Editor every time you change the size, style, or rotation.



Return to Contents

The CVT window




The left column shows distances in resolution-independent units (UPEM) and the right column shows fractional pixels calculated for the current point size, resolution, and transformations that may be in effect. Avalue also reflects any changes to the Control Value Table by the preprogram and is the value accessed by the instructions. The right column is automatically calculated from the value in the UPEM column in fractional pixels, measured in 64ths.

The Control Value Table contains a set of values that can be used, among other things, to control and regularize characteristics for different glyphs inside a particular font. These values can then be used by certain instructions. For instance, the following information about the character set can be stored:


You can change values in the Control Value Table easily, using the instruction set. If the values need to be changed for a specific point sizes of a particular font, the preprogram (see the Preprogram window) can be used to change the values.

There is no standard definition for any entry in the Control Value Table. The meaning of each entry is left to the discretion of the font manufacturer.


Return to Contents

The Text window


This window allows you to see what your font looks like as normal, bold, and oblique text. You type in the text window and choose the different styles from the check boxes at the top of the window.






Return to Contents

The Device window




Device window Description

Mils This measures the size of a pixel on a particular engine in inches. This will automatically change the value of the Engine field.
Engine This measures the size of a pixel on a particular engine relative to a perfect pixel, based on the current resolution. This will automatically change the value of the Mils field. On a screen, Engine is always 0.
User This allows you to change the values in the three-by-three matrix to any values you choose, and the font editor will base its calculations on those values.
Identity The font editor will set the matrix. Rotation The font editor will use the angle typed into the field next to the Rotation radio button to calculate the values for the matrix. The angle is in degrees.
X res, Y res These give the resolution of the device.

These values change nothing in the font. They are useful for seeing how the outlines behave under different raster conditions.

This is the Device window after the Rotation radio button has been chosen, the angle changed to 45, and the OK button clicked. Note that clicking the OK button does not close the window but rather calculates the new information provided.



This is the outline with bits, after the rotation of 45 degrees has taken effect.




Return to Contents

The Outline window

You can edit the actual coordinates of all of the points in an outline. The coordinates are given in UPEM. An empty circle ( o ) next to an entry means that this point is off the curve. A filled in point ( ) means the point is on the curve.



Adding a New Contour line tells the editor that a new contour is coming up. The easiest way for entering a New Contour line is to use the Edit Outline mini-window, which can be brought up by using the Edit command or by pressing Return when you have a line in the window selected. You can also double-click on a line and edit directly in the Outline window. If you are editing directly in this manner, remember to use lowercase o and the option-8 bullet character in order to fill in this information.


Placing one point by itself in a new contour can be a signal that this is where elements for a component character (for instance, a character with an accent) can be joined. (See Component characters for more information.)


Return to Contents

The Info window




The information on the right side of the Info window is read in by the RoyalT Font Editor from the header of the 'sfnt' resource. (Specifically, these values are found in the Horizontal Layout section of the header.) In order, the numbers are:

Info window Header entry

Ascent yAscender
Descent yDescender
Line Gap yLineGap
Caret N horCaretSlopeNum
Caret D verCaretSlopeDen

The next two entries are read in by the font editor from the Horizontal Metrics table for that specific glyph. These values are found in the array of type longHorMetric.

Info window Header entry

LSB Left side bearing
AW Advance width

On the left side of the window are some default values are also read in from the header of the 'sfnt' resource.

Info window Description

Revision Version number for the font developer (fontRevision in the header table). Do not confuse this with the sfntFormatVersion.
UPEM Number of units per em square (unitsPerEm).
Smallest Smallest point size at which the designer has decided the outline will still look good. Bitmaps are generally used below this size.
Twilight This is read from the MaxProfile table (maxTwilightPoints). This value is not computed by the editor and must come from the font manufacturer.
Storage This is read from the MaxProfile table (maxStorage). This value is not computed by the editor and must come from the font manufacturer.
Bold If checked, the font is a bold font. This is set in the StyleWord field of the header.
Italic If checked, the font is an italic font. This is set in the StyleWord field of the header.


Note To effect changes in the Preview window and in other parts of the 'sfnt', you must recalculate when the values in this view are changed.



Return to Contents

The Alpha window

This window shows the current state of the entire font, at the point size specified in the Size menu.



Double-clicking on a character in this window will put that character in the Preview window. Selecting a character and then pressing Return will do the same thing.

To map the character code to the glyph index of your choice, choose the character and then select the Edit command from the SFNT menu. This will bring up the Char-To-Glyph mini-window:




Return to Contents

The Twilight window

The Twilight window shows the current state of the point storage, a section of the graphics state. You can store points here that the instructions can use for storage or reference. What the window shows is the state of character element 0, while the font editor is executing the character instructions.

The Twilight window is only for display, and it cannot be edited.

Return to Contents