Fonts are constructed as a list defining a range of Unicode characters and a subfont containing the character images for that range. Subfonts are not directly accessible from Limbo.
External fonts are described by a plain text file that can be read using the Font.open function. The Font.build function reads the same format from a string rather than a file. (See font - character images for Unicode text in Chapter 11).
The format is a header followed by any number of subfont range specifications. The header contains two numbers: the height and the ascent, both in pixels. The height is the inter-line spacing and the ascent is the distance from the top of the line to the baseline. These numbers should be chosen to consistently display all the subfonts of the font.
A subfont range specification contains two or three numbers and a file name. Each field must be followed by some white space. Each numeric field may be decimal, octal, or hexadecimal in the C language format. The numbers are the inclusive range of characters covered by the subfont with an optional starting position within the subfont.
The file name specifies an external file holding the subfont data. The minimum number of a covered range is mapped to the specified starting position (default zero) of the corresponding subfont. If the subfont file name does not begin with a slash, it is taken relative to the directory containing the font file.
External subfonts are represented in a more rigid format. The components must appear in the following order:
An image containing character images
The image has the format for external image files described in image - external format for images.
A subfont header
The subfont header has 3 decimal strings: n, height, and ascent. Each number is right-justified and blank padded in 11 characters, followed by a blank.
The character info consists of n+1 entries, each 6-bytes and giving values called x (2 bytes, low order byte first), top, bottom, left, and width for the successive characters from left to right (in increasing Unicode order) in the subfont.
The rectangle holding the character is (x, top, xn, bottom), where xn is the x field of the next character.
When the character is to be drawn in an image at point p, the rectangle is placed at (p.x+left, p.y) and the next character to be drawn is placed at (p.x+width, p.y).
The x field of the last entry is used to calculate the image width of the previous character. The other fields in the last entry can be ignored.
There is a convention of using the character with value zero (nul) to represent characters of zero width. This means that fonts should have, as their zero-th character, a character with non-zero width. See the description of the Image.text function in Image - pictures and drawing.
Copyright © 1996,Lucent Technologies, Inc. All rights