#if HAVE_FONT_FUSION
#ifndef FONT_FUSION_H
#define FONT_FUSON_H

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "device.h"

#undef DEBUG
#include "t2k.h"
#ifdef CACHE_T2K
#include "cachemgr.h"
#else
#include "ff_fm.h"
#endif

#define DEBUG
#ifndef CPU75
#define ALL_BLACK_AND_WHITE 1
#endif
#define USE_MMAP

typedef struct {
	PMWFONTPROCS    fontprocs;      /* common hdr*/
	MWCOORD         fontsize;
	int             fontrotation;
	int             fontattr;
	
	/* Font Fusion */
	tsiMemObject 	*mem;
	InputStream 	*InputStreamA;
#ifndef CACHE_T2K
	InputStream 	*InputStreamB;
#endif
	int 		font_code;
	unsigned char	*data;
	int 		ref_count;
#ifdef CACHE_T2K
	T2K             *scaler;
	sfntClass       *font;
#endif
	int		isCJK;
	//int (*cjk_getnextchar)(const unsigned char* s, unsigned char* cc);
	//int (*cjk_getfontseq)(unsigned char* ch);
	int		FileLength;
	unsigned char	widths[256];
#ifdef USE_MMAP
	int		fd;
#endif
	int 		offset; //GB and Japanese font need an offset.
} MWFONTFUSIONFONT, *PMWFONTFUSIONFONT;


int fontfusion_init(PSD psd);
PMWFONTFUSIONFONT fontfusion_createfont(const char *name, MWCOORD height, int fontattr);

#ifdef HAVE_CJK_SUPPORT
#define FONTFUSION_FONT_DIR CJK_FONT_DIR
#else
#define FONTFUSION_FONT_DIR "/usr/local/microwin/fonts/t2k"
#endif

#endif //FONT_FUSION_H
#endif
