HBF(3) Manual Page

NAME

hbf - interface to HBF bitmap font files

SYNOPSIS

#include "hbf.h"

HBF	*hbfOpen(const char *filename);

void	hbfClose(HBF *hbf);

const	char	*hbfProperty(HBF *hbf, const char *propName);

const	unsigned char	*hbfGetBitmap(HBF *hbf, HBF_CHAR code);

void	hbfForEach(HBF *hbf, void (*func)(HBF *sameHbf, HBF_CHAR code));

const	char	*hbfFileName(HBF *hbf);

long	hbfChars(HBF *hbf);

HBF_BBOX *hbfBitmapBBox(HBF *hbf);

HBF_BBOX *hbfFontBBox(HBF *hbf);

unsigned HBF_RowSize(HBF *hbf);

unsigned HBF_BitmapSize(HBF *hbf);

unsigned HBF_GetBit(HBF *hbf, unsigned char *bitmap, unsigned x, unsigned y);

int	hbfDebug;

DESCRIPTION

These routines provide access to bitmap fonts described by HBF (Hanzi Bitmap Font) files.

hbfOpen attempts to open a named HBF file. Under Unix, the environment variable HBFPATH, if defined, is a colon-delimited list of directories to search for a relative filename. The type HBF is defined in hbf.h. If the open fails, NULL is returned.

hbfClose closes the file, and releases all associated data structures.

hbfProperty retrieves the property value associated with a property name in the HBF file, or NULL if the property is undefined.

hbfGetBitmap retrieves the bitmap associated with a character code, represented by the integral type HBF_CHAR (also defined in hbf.h). This bitmap may be overwritten by subsequent calls to hbfGetBitmap on the same HBF file. It returns NULL if the character has no such bitmap.

hbfForEach calls the function func for character defined by the font, with arguments hbf and the character code.

hbfFileName returns the name of the HBF file. hbfChars returns the total number of characters defined by the font.

hbfBitmapBBox and hbfFontBBox return the bitmap and font bounding boxes respectively. Each bounding box is described by the following structure, defined in hbf.h:

typedef struct {
	unsigned short	hbf_width;
	unsigned short	hbf_height;
	short		hbf_xDisplacement;
	short		hbf_yDisplacement;
} HBF_BBOX;

HBF_RowSize and HBF_BitmapSize are macros yielding the size in bytes of each row of a bitmap, and of a whole bitmap, respectively.

HBF_GetBit is a macro yielding the bit value (0 or 1) of the bit at coordinates (x,y) in bitmap, returned from hbf.

DIAGNOSTICS

If the variable hbfDebug is set to a non-zero value, errors will be reported on stderr.

SEE ALSO

Hanzi Bitmap Font (HBF) File Format version 1.1.

AUTHOR

Ross Paterson <rap@doc.ic.ac.uk>