deflfont(3G) deflfont(3G)
deflfont - defines a raster font capable of accommodating large rasters
and multi-byte character id's
void deflfont(n, nc, chars, nr, raster)
short n;
long nc;
Lfontchar chars[];
long nr;
unsigned short raster[];
n expects the value to use as the identifier for this raster font.
The default font is a fixed-pitch ASCII font with a height of
15, width of 9, character values 0 through 127 defined, and is
specified by a font identifier of 0. Font 0 cannot be
redefined.
nc expects the number of elements in the chars array.
chars expects an array of character description structures of type
Lfontchar. One structure is required for each character in the
font. The Lfontchar structure is defined in <gl/gl.h> as:
typedef struct {
unsigned long value;
unsigned long offset;
short w, h;
short xoff, yoff;
short xmove, ymove;
} Lfontchar;
value expects the integer value corresponding to this character.
When value is encountered by charstr or lcharstr this character
is drawn.
offset expects the element number of raster at which the bitmap
data for this character begins. Element numbers start at zero.
w expects the number of columns in the bitmap that contain set
bits (character width).
h expects the number of rows in the bitmap of the character
(including ascender and descender).
xoff expects bitmap columns between the start of the character's
bitmap and the start of the character.
yoff expects the number rows between the character's baseline
and the bottom of the bitmap. For characters with descenders
(e.g., g) this value is a negative number. For characters that
Page 1
deflfont(3G) deflfont(3G)
rest entirely on the baseline, this value is zero.
xmove expects the pixel spacing for the character. This signed
value is added to the x-coordinate of the current raster
position after the character is drawn.
ymove expects the pixel spacing for the character. This signed
value is added to the y-coordinate of the current raster
position after the character is drawn.
nr expects the number of 16-bit integers in raster.
raster expects a one-dimensional array containing all the bitmap data
for the characters in the font. The bitmap data for each
character is a set of consecutive, 16-bit integers, comprising
the bit mask for the character from left to right, bottom to
top. For characters of width greater than 16, the rows of a
bitmap span more than one array element, however, each new row
in the character bitmap must start with its own array element.
The number of 16-bit integers per row in a character's bitmap is
(w+15)/16. The total number of 16-bit integers in a character's
raster definition is h*((w+15)/16).
Bit 15 of each element is left-most when displayed. Bits that
are '1' are drawn, bits that are '0' are masked.
deflfont defines a new raster font, or adds/replaces character
definitions in the current raster font. If the font did not exist, it is
created. If it did exist, the character descriptions in the current call
replace any currently defined characters of the same value.
deflfont and defrasterfont share the same name space for font id's, so
programmers should beware of collisions. Also, raster fonts initially
defined with defrasterfont may not augment their character sets via
subsequent calls to deflfont.
If deflfont is called with nc set to zero, the font is deleted.
charstr, cmove, font, getcpos, getdescender, getfont, getheight,
lcharstr, lstrwidth, strwidth
This routine is available only in immediate mode.
PPPPaaaaggggeeee 2222 [ Back ]
|