Importing and Exporting Fonts

Converting Fonts

The TYPO Font Editing System contains also a number of conversion programs from TYPO Raster and Curve formats into a variety of other formats, and back. These are implicitly executed when a font is loaded or stored.

For users wishing to convert from/to their own font formats, the formats of TYPO Raster and TYPO Curve fonts is described below.

TYPO Font Formats

TYPO fonts are ASCII files. Each line begins with an identifying character which may be followed by additional information. All lines may be trailed by SPACEs.

Font Header Structure

The font header information is common to curve and raster fonts. The first line begins with a comment symbol ('#') and is followed by another symbol distinguishing between curve and raster fonts. Another comment symbol identifies curve fonts, and a colon identifies raster fonts. The next lines describe font properties:
H "I_(name)" num
Horizontal guide line at base y+num with type or name name
V "I_(name)" num
Vertical guide line at base x+num with type or name name
V "I_(name)" num R
Vertical guide line at base x+width+num with type or name name
I num
Italics angle is num degrees
U underthick
Font underline thickness is underthick
P psize dsize
Point size is psize and design size is dsize
N name fullname
Font name is name and font full name is fullname
F famname
The font belongs to family famname
W weight width
Font weight is weight and font width is width (between 0-10)
s style
Font style is style
X version
Font version is version
c "I_(copyrt)" "I_(note)"
Copyright statement is copyrt and notice is note
Y encoding
Font default encoding is encoding
f foundry
Font type foundry is foundry
n number
Font identification number is number
d yymmdd yymmdd
Creation and last modification dates

The guide line order is top-to-bottom for horizontal guide lines and left-to-right for vertical ones.

The properties are followed by a sequence of character descriptions. The last character description is followed by a single line with the identification character E. If the font contains multiple masters, each master except for the last is terminated by a single line of the form

EM

The last master is again terminated by a single line containing only the letter

E

Font Character Entries

Each character description begins with a glyph line. Since the format of this line is different for raster and curve characters, it is described below separately for both cases.

If the character kerns with any following characters, then the glyph line is followed by kerning lines:

K hex_1 val_1 . . . hex_n val_n
This line indicates that the character with hexadecimal code hex is to be moved by val if it follows the present character (as defined in the glyph line). Alternatively, the line
KS hex
specifies that the present character kerns the SAME AS the character with code hex.

Curve Font Specifics

As said before, curve fonts begin with a line of the form
## comment
Font properties specific to curve fonts are:

T t_1 t_2 r
Tie threshold point sizes are t_1 (horizontally) and t_2 (vertically) at resolution r
O e
e is 2 if the file was edited with TYPO, otherwise 1 (if obtained by conversion from another font format)
mmodecode paint parameters
The paint mode for the whole font

The following table presents an overview of the parameters applicable for each paint mode.
Paint modecodePaint parameters
Defaultmd
Outlinemowstrokewidth
Even-odd fillmegarea grey
Wrap count fillmfgarea grey
StrokemsGstrokegrey clinecap jlinejoin wstrokewidth mmiterlimit
Even-odd fill/StrokemEgareagrey Gstrokegrey clinecap jlinejoin wstrokewidth mmiterlimit
Wrap count fill/StrokemFgareagrey Gstrokegrey clinecap jlinejoin wstrokewidth mmiterlimit
Elliptic penmlGstroke grey ppenwidth Ppenheight apenangle
Rectangular penmrGstroke grey ppenwidth Ppenheight apenangle

Each curve character description begins with a glyph line. If the position of the character is less than 256, its form is one of these three:

If the character position is 256 or greater, it form is one of these three:

where:

A sequence of curve descriptions follows:

B x1 y_1 x2 y2 x3 y3
Bézier curve via (x1, y1), (x2, y2) to (x3, y3)
A x1 y1 x2 y2 x3 y3 xc yc r
Arc via (x1, y1), (x2, y2) to (x3, y3) with center (xc, yc) and radius r
L x1 y1
Line to (x1, y1)
M x1 y1
Movement to (x1, y1)

A curve description may be followed by one or more of the following lines (but at most one of each kind):

C curvenum
This curve is closed up to curve curvenum (counting from 1) in this character
h hintname hint kind tied hint
There is a horizontal (stem) hint at the end of this curve by the name hintname (one alphanumeric character). The hint is of the kind hint kind. If this is a tied hint, the entry tied hint will also appear; it is the name of the hint to which this point or point pair is tied to.
v hintname hint kind tied hint
There is a vertical (beam) hint at the end of this curve by the name hintname (one alphanumeric character). The hint is of the kind hint kind. If this is a tied hint, the entry tied hint will also appear; it is the name of the hint to which this point or point pair is tied to.

Hint kinds are as follows (see also the section on Hints):
Hint Kinds
Hint kindDescription
AAdjoined hint
L, RStem/beam hint
Left and right points of a stem hint pair
Upper and lower points of a beam hint pair
l, rPoint hint tied to hint tied hint
Point is tied to the left/right point of a stem hint
Point is tied to the upper/lower point of a beam hint
T, tTie hint tied to hint tied hint
Left and right points of a tie stem hint pair
Upper and lower points of a tie beam hint pair
G, g Point hint tied to a guide line with overhang alignment zone above
The guide line is above or below the tied point
K, k Point hint tied to a guide line with overhang alignment zone below
The guide line is above or below the tied point
I, i Tie hint tied to a guide line with overhang alignment zone above
Upper and lower points of the pair
Y, y Tie hint tied to a guide line with overhang alignment zone below
Upper and lower points of the pair

The h and v lines may also occur immediately before the first curve description. In this case, the first point of the curve is hinted.

Rigidity is specified as follows:

r
The preceding curve is rigid

Raster Font Specifics

Font properties specific to raster fonts are:
#: comment
The opening line of a raster font
O e s r
e is 2 if the file was edited with TYPO, 0 if it was converted from a TYPO curve font, and 1 otherwise (e.g. if obtained by conversion from another font format). s is the conversion scale factor if converted from a curve font, and r is the intended device resolution
G "I_(name)" hex "I_(ASCII/decimal)" left right up down width
This glyph line marks the beginning of a raster character. name is the full name of the character, hex is the 2-hex-digit position of the character within the font (without a preceding 0x), ASCII/decimal is the ASCII image of the character position (in the range 0 to 255). Positions between 128 and 159 are preceded by <, and positions beyond by >. For characters beyond 255, the decimal position of the character within the font is specified. (left, up) is the base point location in the character matrix. right is the horizontal extent of the matrix beyond the base point. down is the vertical extent of the matrix beyond the base point. width is the character width.
R w1 b1 w2 b2 . . . wn bn
A sequence of row descriptions of this form follows the glyph line. A row description may extend over more than one line. A character row is now described using the run length method: A pair w b describes w white pixels followed by b black pixels.
D num
A row description may be followed by a duplication line. A duplication line indicates that the raster row is to be duplicated num times.