This document describes the structure of the font definition file, including the font bitmap, typeface and font store file definitions.
A font definition file consists of a statement list, which defines bitmaps, typefaces and font store files.
The font definition file is characterised by:
.gdf
files and incorporated into the .gd
file by using #include statements, e.g.#include ari16.gdf
where the filename (ari16
) is conventionally the font-bitmap-label from the font bitmap definition.
BDF files can also be included in the same way, e.g.
#include roman11.bdf
Font definition files containing #include statements need to be processed by the C pre-processor before conversion with fnttran
. For example, to translate tfont.gd
you would type:
cl /P /EP tfont.gd fnttran tfont.i tfont.gdr
Section Contents
A font bitmap is characterised by:
The diagram below shows the @ character (font: Arial). It has a width of 16 pixels (maximum), height 16 pixels and ascent 11 pixels.
A code section defines the bitmaps for characters in the range code-point-start to code-point-end. Each character in this range is defined by a char-clause. Successive char-clauses define successive characters in ascending numerical order through the range. There must be precisely the required number of char-clauses, (code-point-end - code-point-start + 1).
Each character is defined by an optional left adjust and/or right adjust, and then a series of pixel lines. The number of character lines defined between Char and EndChar must be equal to zero or cell-height.
A char-pixel-line-definition consists of a sequence of period and asterisk characters. A period represents a white pixel, and an asterisk represents a pixel which forms part of the character itself.
Each pixel line definition in a char-clause must be the same length.
For example, this is the definition for the g character (Font: Times New Roman, 20 pixel, Bold Italic Proportional):
Char 103 Adjust -1 0 ! 'g' .......... .......... .......... .......... .......... .......... .......... ....****.. ...**..*** ..**...**. ..**...**. ..**..***. ...*****.. ..**...... ..*****... .**.****.. **....**.. **....**.. .*****.... .......... EndChar
The char-pixel-line-definition-list always starts with the topmost row of pixels in the character cell. The lines continue downwards for every row of pixels until the definition contains cell-height rows.
.gdr
filesA KFontStoreFileVer9Uid is used to identify the filetype. These files are conventionally incorporated in font definition files by using #include.
The Typeface statement defines a typeface and gives it a label, typeface-label.
The typeface also has a full name typeface-name.
The typeface may be a symbol typeface Symbol and/or proportional Proportional and/or serif Serif. If Symbol is not stated then the typeface is normal. If Proportional is not stated then the typeface is monospaced. If Serif is not stated then the typeface is sans-serif.
A typeface contains several font bitmaps, each defined by a reference:
The uid form refers to the font bitmap identified by its UID, as specified in the UID clause of the font-bitmap-statement. The font bitmap must be accessible to the font bitmap server when this typeface is used at run-time. Typically, the uid form is used to refer to fonts which are guaranteed to be in the ROM, but are not in this compilation unit, for example, the tiny fonts.
The font-bitmap-label form refers to a font bitmap that has previously been defined, using a FontBitmap statement with that label, in this compilation unit. The font bitmap may be algorithmically enlarged by n-tupling the width using WidthFactor width, and/or n-tupling the height using HeightFactor height. This avoids the need for too many font bitmap definitions. The example below shows a normal and WidthFactor 2 character, (font: Times New Roman, 20 pixel, Bold Italic Proportional):
Note that a font bitmap does not have to be incorporated into a typeface to be accessible to the font and bitmap server.
The FontStoreFile statement defines a destination font store file. The font store file is identified by its collection UID uid. NB. The UID must be specified in decimal, rather than in the OPL-style, &xxx syntax.
A font store file contains several typefaces, each defined by a typeface-label. The typeface-label refers to a previously defined typeface, in this compilation unit.
Copyright information is specified in the copyright clause any number of lines of text, each of which must be surrounded by quotes ("), between the CopyrightInfo and EndCopyrightInfo keywords.
The aspect-ratio identifier gives the aspect ratio of the device for which the font is designed (1000*PixelHeightInTwips/PixelWidthInTwips).
Fnttran supports BDF V2.2 but without the support for multiple writing directions as this is not supported by EPOC. The characters must be listed in order of Unicode encoding. The name of the font, following FONT, is the label used to identify the individual font bitmap when the typefaces are constructed. Some additional keyword should be supplied in the PROPERTIES section of the BDF file however.
STARTPROPERTIES 3 Uid 999999 // A uid enabling the font bitmap to be requested MaxNormalCharWidth 12 // The maximum normal width of characters in pixels. MaxConsecutiveFillChars 0 ENDPROPERTIES
The final keyword (MaxConsecutiveFillChars) is optional and controls whether breaks are made between code sections when there are missing characters in the input BDF file.
See http://partners.adobe.com/supportservice/devrelations/typeforum/tchntlist.html for further details of BDF format.