All symbols defined by FONTLIB have the
Before the first use of FONTLIB, the
font_init function must be called.
On the other hand, the cleanup is done by the
FONTLIB provides a powerful font server which caches the loaded fonts.
Every font loaded into the fontserver gets a unique integer identification number,
called the font ID or also the font descriptor. A zero or negative font ID
is considered invalid.
A font file can be loaded via the
The font server keeps track of loaded fonts and does not load twice
the same file into the memory.
Caching is managed by the FreeType library. That means that if the memory
is low or there are many fonts loaded, only the recently used fonts
are present in memory. The others are “swapped” and opened on demand.
Most of the communication with rendering routines, bounding box computing
and other functions is done via the
struct font_ctl structure,
which is passed as an argument. Here you specify the font ID,
font size (measured in millimeters), transformation, etc.
Do not forget that this structure has to be properly initialized and also
cleaned up by the
The actual rendering of one glyph and a whole string
is done by the functions
These functions perform some computation, then call FreeType to do
the low-level glyph rendering and return the resulting bitmap.
To compute the bounding box (in millimeters) of a given glyph or string,
there are the
Again, they are controlled via the
struct font_ctl structure.
The rest of the functions does not need any special comments,
just look in the reference manual or font/font.h source.
We just briefly sketch the functionality.
There are routines returning various
font information (
Some font formats can be converted into some other (
see Font conversions for details.
There is also the not yet fully implemented support for expanding
fonts into the GEOMLIB curve representation (
FONTLIB also includes a logic for finding the most similar font if
the original one is not available (
font_search). The FontConfig
library is utilized here.