.TH FONT 6
.SH NAME
font, subfont \- external format for fonts and subfonts
.SH SYNOPSIS
.B #include <libg.h>
.SH DESCRIPTION
Fonts and subfonts are described in
.IR cachechars (2).
.PP
External fonts are described by a plain text file that can be read using
.I rdfontfile.
The format of the file is a header followed by any number of
subfont range specifications.
The header contains two numbers: the height and the ascent.
The height is the inter-line spacing and the ascent is the distance
from the top of the line to the baseline.  These numbers are chosen
to display consistently all the subfonts of the font.
A subfont range specification contains two numbers and a file name.
The numbers are the inclusive range of characters covered by the subfont,
and the file name names an external file suitable for
.IR rdsubfontfile .
The minimum number of a covered range is mapped to character 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.
Each field must be followed by some white space.
Each numeric field may be C-format decimal, octal, or hexadecimal.
.PP
External subfonts are represented in a more rigid format
that can be read and written using
.I rdsubfontfile
and
.I wrsubfontfile
(see
.IR subfalloc (2)).
The format for subfont files is: a bitmap containing character images,
followed by a subfont header, followed by character information.
The bitmap has the format for external bitmap files described in
.IR bitmap (6).
The subfont header has 3
decimal strings:
.BR n ,
.BR height ,
and
.BR ascent .
Each number is right-justified and blank padded in 11 characters, followed by a blank.
The character
.B info
consists of
.BR n +1
6-byte entries, each giving the
.B Fontchar
.B x
(2 bytes, low order byte first),
.BR top ,
.BR bottom ,
.BR left ,
and
.BR width .
The
.B x
field of the last
.B Fontchar
is used to calculate the bitmap width
of the previous character; the other fields in the last
.B Fontchar
are irrelevant.
.SH "SEE ALSO"
.IR graphics (2),
.IR bitblt (2),
.IR cachechars (2),
.IR subfalloc (2)
