#ifndef OBJFONT_H
#define OBJFONT_H
#include "objgfx30.h"
#define LeftText 0
#define CenterText 1
#define RightText 2
#define BottomText 0
#define TopText 2
enum TFontType {BLF, BMF, DPF};
typedef struct {
char ID[4];
UInt8 BPP;
UInt8 paddington[10];
} TFontHeader;
typedef struct {
char ID[3];
UInt8 Version;
UInt8 Width, Height;
UInt8 NumOfChars;
UInt8 StartingChar;
UInt8 ColourType;
UInt8 paddington[7];
} TDPFHeader;
class TFont {
protected:
void * FontDataIdx[256];
UInt16 CharWidthTable[256];
UInt16 CharHeightTable[256];
TGfx0* Buf;
UInt32 FontDataSize;
void * FontData;
public:
TFont(TGfx0 *);
virtual void PutText(Int32, Int32,const char *)=0;
void CenterTextX(Int32 Y, const char *);
void JustifyText(UInt8, UInt8, const char *);
bool Load(const char *);
virtual bool LoadFrom(const char *, UInt32)=0;
bool Save(const char *);
virtual bool SaveTo(const char *, Int32)=0;
UInt32 TextHeight(const char *);
UInt32 TextWidth(const char *);
virtual ~TFont(void);
}; // TFont
class TBMFont : public TFont {
protected:
UInt32 ColourTable[256];
public:
TBMFont(TGfx0 *Buffer): TFont(Buffer) {
for (UInt32 tmp=0; tmp<=255; tmp++) ColourTable[tmp]=tmp;
}
void SetColor(UInt32);
void SetIdxColor(UInt8, UInt32);
void PutText(UInt32, UInt32, const char *);
};
#endif