vfont2(5)

NAME
vfont2 - variable-size font format

SYNOPSIS
/usr/lib/vfont/*

DESCRIPTION
vfont2 is an attempt to overcome the limitations of the original vfont(5) file format to support more than 256 characters, larger characters, and Unicode. The header has the following format:

#define VFONT2_MAGIC0 0x27
#define VFONT2_MAGIC1 0x5b
#define VFONT2_MAGIC2 0xA4
#define VFONT2_MAGIC3 0x68

/* bits used in flags */
#define VFONT2_HAS_UNICODE_TABLE 0x01

/* max version recognized so far */
#define VFONT2_MAXVERSION 0

/* UTF8 separators */
#define VFONT2_SEPARATOR  0xFF
#define VFONT2_STARTSEQ   0xFE

struct vfont2_header {
        unsigned char magic[4];
        unsigned int version;
        unsigned int headersize;    /* offset of dispatch table */
        unsigned int flags;
        unsigned int length;        /* number of glyphs */
        unsigned int bitmap_size;   /* total number of bytes for bitmaps */
        unsigned int max_height;    /* max size of a character bitmap */
	unsigned int max_width;
};

Compared to an original vfont file, the "unused" xtend field has no counterpart. If an extension to the header is required, it would be straightforward to increase headersize and add the extra field(s).

At offset headersize in the file is the dispatch table. This has length entries, each 18 bytes long.

struct vfont2_dispatch {
	unsigned int addr;	    /* offset of glyph from start of bitmaps */
	unsigned int size;          /* number of bytes (0 if no glyph) */
	signed short up;	    /* number of rows above baseline point */
	signed short down;	    /* number of rows below baseline point */
	signed short left;	    /* number of columns left of baseline point */
	signed short right;	    /* number of columns right of baseline point */
	signed short width;         /* logical width, used by troff */
};

The number of lines present in the bitmap is up + down. Similarly, the number of columns is left + right.

Provided the total height and width remain positive, any of up, down, left or right can be negative. This corresponds to a baseline point outside the character bitmap.

The logical width is used when rendering the characters; it gives the number of pixels between one character's baseline point and the next.

The bitmaps immediately follow the dispatch table. For each character, there are up + down rows, each (( left + right ) + 7) / 8 bytes.

If a Unicode table is present, it will immediately follow the bitmaps. It is in the same format as PSF2:

<unicodedescription> := <uc>*<seq>*<term>
<seq> := <ss><uc><uc>*
<ss> := 0xFE
<term> := 0xFF

where <uc> is a Unicode value coded in UTF-8, and * denotes zero or more occurrences of the preceding item.

The leading <uc>* part gives Unicode symbols that are all represented by this font position. The following sequences are sequences of Unicode symbols — probably a symbol together with combining accents — also represented by this font position.

For example, at the font position for a capital A-ring glyph, the Unicode sequence may be:

c3 85 e2 84 ab fe 41 cc 8a ff

The first six bytes correspond to two Unicode characters (U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE and U+212B ANGSTROM SIGN). Then 0xfe acts as a separator, and the next three bytes correspond to the two Unicode characters U+0041 LATIN CAPITAL LETTER A and U+030A COMBINING RING ABOVE.

SEE ALSO
vfont(5), psf2vfont(1), vfont2psf(1), txt2vfont(1), vfont2txt(1), vfont2ppm(1)

AUTHOR
John Elliott <seasip.webmaster@gmail.com>.