We have many font files and many different font file formats are available. When we need a software to display or print characters which does not depend on a windowing system and/or an operating system, we must write interface routines for accessing font files in each application software again and again. To do this, programmers must have knowledge on font file formats; it will be a hard task for programmers if the number of font formats that an application software supports becomes large.
VFlib is a font library written in C providing several functions to obtain bitmaps of characters. VFlib hides the font format of font files and provides a unified API for all supported font formats. Thus, programmers for application software need not have knowledge on font file formats. Instead, any software using VFlib can support various font file formats immediately.
As described above, VFlib supports many font file formats and absorbs differences between font file formats. Currently, VFlib supports the following font file formats: PCF, BDF, HBF, TrueType, Type1, GF, PK, Virtual fonts, TFM, SyotaiKurabu (a vector font format for Japanese Kanji), JG (another vector font format for Japanese Kanji).
The internal structure of VFlib is as follows:
The VFlib system consists of two parts:
We can obtain bitmaps of a font by the following procedure:
fid = VF_OpenFont1("cmr10.pk", dpi_h, dpi_v, -1, mag_h, mag_v);
bm = VF_GetBitmap1(fid, code_point, mag_h, mag_y);
cmr10.pk) and its concrete definition. By a vflibpca,
cmr10.pkcan be a font file from a PK font file
cmr10.300pk. It can be a Type 1 font
cmr10.pfbby another vflibcap definition. VFlib is implemented to provide unified view for different font formats; application software need not aware of the difference of font formats and uses different font formats tranceparently.