summaryrefslogtreecommitdiffstats
path: root/noatun/modules/kjofol-skin/kjfont.h
blob: 69e1205216ca2c20089ca1ae5b8108c5280245c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef KJFONT_H
#define KJFONT_H

#include <tqstring.h>
#include <tqpixmap.h>
#include <tqbitmap.h>
#include <tqfont.h>

class KJLoader;

class KJFont
{
public:
	KJFont(const TQString &prefix, KJLoader *parent);
	// draw the string str to dev at position pos, within rectangle limit in relation to pos
	TQPixmap draw(const TQCString &str, int wide, const TQPoint &pt=TQPoint(0,0)) const;
	TQPixmap draw(const TQString &str, int wide, const TQPoint &pt=TQPoint(0,0)) const
		{ return draw(TQCString(str.latin1()), wide, pt); }

	int fontHeight() const {return mHeight;}
	int fontWidth() const {return mWidth;}
	int fontSpacing() const {return mSpacing;}
	bool isTransparent() const {return mTransparent;}

	// !!! Call if you changed the systemfont !!!
	void recalcSysFont(void);

protected:
	TQPixmap drawSysFont(const TQCString &s, int wide, const TQPoint &pos=TQPoint(0,0)) const;
	TQPixmap drawPixmapFont(const TQCString &, int, const TQPoint &pos=TQPoint(0,0)) const;

	void drawCharacter(TQPixmap *dev, TQBitmap *devMask, const TQPoint &to, char c) const;
	TQPoint charSource(char c) const;

private:
	TQPixmap mText;
	TQBitmap mTextMask;
	TQRgb mTransparentRGB; // this color will be transparent
	int mSpacing;
	int mWidth, mHeight;
	bool mTransparent; // indicates wether there's transparency
	const char *mString[3];
	char mNullChar;
	TQFontMetrics *sysFontMetrics;
	TQFont sysFont;
	TQColor sysFontColor;
	bool mUseSysFont;
};

#endif