#ifndef __BITMAP_FONT_H
#define __BITMAP_FONT_H

#include "device.h"

typedef struct {
	char           *name;          /* font name */
	int            maxwidth;       /* max width in pixels */
	int            height;         /* height in pixels */
	int            ascent;         /* ascent (baseline) height */
	int            firstchar;      /* first character in bitmap */
	int            size;           /* font size in characters */
	MWIMAGEBITS    *bits;          /* 16-bit right-padding bitmap data */
	unsigned short *offset;        /* 256 offsets into bitmap data */
	unsigned char  *width;         /* 256 character widths or 0 if fixed */
} WesternBitmapFont;

typedef struct {
	PMWFONTPROCS fontprocs;        /* Common Header */
	MWCOORD      fontsize;
	int          fontrotation;
	int          fontattr;

	WesternBitmapFont *wbfont;     /* Internal Data */
} MWWESTERNBITMAPFONT, *PMWWESTERNBITMAPFONT;

MWBOOL western_bitmap_init		(PSD psd);
PMWFONT western_bitmap_createfont	(const char *name,
					 MWCOORD height,
					 int fontattr);


typedef struct {
	int           width;           /* width in pixels */
	int           height;          /* height in pixels */
	int           base;            /* base in pixels */
	int           fd;              /* file descriptor */
	unsigned long maxsize;         /* file's size */
	MWIMAGEBITS   *bits;           /* 16-bit right-padding bitmap data */
	unsigned int  (*getfontseq)(unsigned char c1, unsigned char c2);
} AsianBitmapFont;

typedef struct {
	PMWFONTPROCS fontprocs;        /* Common Header */
	MWCOORD      fontsize;
	int          fontrotation;
	int          fontattr;

	AsianBitmapFont *abfont;       /* Internal Data */
} MWASIANBITMAPFONT, *PMWASIANBITMAPFONT;

#define ASIAN_BITMAP_ENCODING(offset)     ((offset)[0])
#define ASIAN_BITMAP_WIDTH(offset)        ((offset)[1])
#define ASIAN_BITMAP_HEIGHT(offset)       ((offset)[2])
#define ASIAN_BITMAP_BASE(offset)         ((offset)[3])
#define ASIAN_BITMAP_DATA_OFFSET(offset)  ((offset) + 4)

MWBOOL asian_bitmap_init		(PSD psd);
PMWFONT asian_bitmap_createfont		(const char *name,
					 MWCOORD height,
					 int fontattr);

#endif /* !__BITMAP_FONT_H */
