////////////////////////////////////////////////////////////
// softfont.h

struct CHARDESC
{
	unsigned char  format;		// 4: raster, 10: Intellifont
			 char  continuation;
//  if continuation is set, rest of descriptor not present,
//  only character raster data follows
	unsigned char  cdsize;		// 14: raster, 2: Intellifont
	unsigned char  charclass;	// 1:bitmap, 2:compressed bitmap, 3:Contour (Intellifont), 4:Compound Contour (Intellifont)
	unsigned char  orientation;
	unsigned char  reserved;
	         short leftoffset;
	         short topoffset;
	unsigned short width;
	unsigned short height;
	         short deltax;
//  immediately followed by raster data
};

struct FONTDESC
{
	unsigned short fdsize;			// 64 for bitmap, 80 for Intellifont
	unsigned char  format;			// 0 for bitmap, 10 for Intellifont
	unsigned char  type;			// 0: 32-127, 1: also 160-255, 2: 0-255
	unsigned char  stylemsb;		
	unsigned char  reserved;
	unsigned short baseline;
	unsigned short cellwidth;
	unsigned short cellheight;
	unsigned char  orientation;
	         char  spacing;
	unsigned short symbolset;
	unsigned short pitch;
	unsigned short height;
	unsigned short xheight;
	         char  widthtype;
	unsigned char  stylelsb;
	         char  weight;
	unsigned char  typefacelsb;
	unsigned char  typefacemsb;
	unsigned char  serifstyle;
	unsigned char  quality;
	         char  placement;
	         char  underlinedistance;
	unsigned char  underlineheight;
	unsigned short textheight;
	unsigned short textwidth;
	unsigned short firstcode;
	unsigned short lastcode;
	unsigned char  pitchex;
	unsigned char  heightex;
	unsigned short capheight;
	unsigned char  fontno[4];
	         char  fontname[16];
#if 0	// Intellifont
	unsigned short scalefactor;
	unsigned short masterxres;
	unsigned short masteryres;
	unsigned short masterunderlineposition;
	unsigned short masterunderlineheight;
	unsigned short lrethreshold;
	unsigned short globalitalicangle;
	unsigned short globalintillifontdatasize;
//				   globalintillifontdata;
#endif
	unsigned short copyrightlen;
//  copyright data here
#if 0
	unsigned char  reserved2;
	unsigned char  checksum;
#endif
};

typedef struct FONTNODE
{
	struct FONTNODE *next;
	unsigned short id;
	CHARDESC *cd[256];
	FONTDESC fd;
//  followed by copyright information
} *FONTLIST;

FONTNODE *font_find( int id );
FONTNODE *font_new( int id, char *pdata, int cdata );
CHARDESC *font_newchar( int id, int charcode, char *pdata, int cdata );
int font_drawchar( unsigned char bits[3300][300], int x, int y, FONTNODE *pf, int charcode );