1 #ifndef __IRR_FONT_TOOL_INCLUDED__
2 #define __IRR_FONT_TOOL_INCLUDED__
3 
4 
5 #include "irrlicht.h"
6 
7 #if defined(_IRR_WINDOWS_)
8 	#ifdef _MBCS
9 		#undef _MBCS
10 	#endif
11 
12 	#define UNICODE
13 	#define _WIN32_WINNT 0x0500
14 	#include "windows.h"
15 #else
16 	#ifdef _IRR_COMPILE_WITH_X11_
17 	#include <X11/Xlib.h>
18 	#endif
19 	#include <X11/Xft/Xft.h>
20 	#include <set>
21 #endif
22 
23 
24 namespace irr {
25 	class CFontTool : public irr::IReferenceCounted
26 	{
27 	public:
28 		CFontTool(irr::IrrlichtDevice* device);
29 		~CFontTool();
30 
31 		virtual bool makeBitmapFont(u32 fontIndex, u32 charsetIndex,
32 				s32 fontSize, u32 texturewidth, u32 textureHeight,
33 				bool bold, bool italic, bool aa, bool alpha);
34 
35 		virtual bool saveBitmapFont(const c8* filename, const c8* format);
36 
37 		virtual void selectCharSet(u32 currentCharSet);
38 
39 		struct SFontArea
40 		{
SFontAreaSFontArea41 			SFontArea() : rectangle(), underhang(0), overhang(0), sourceimage(0) {}
42 			core::rect<s32> rectangle;
43 			s32		underhang;
44 			s32		overhang;
45 			u32		sourceimage;
46 		};
47 
48 	/*	struct SFontMap
49 		{
50 			SFontMap() :  areas(), start(0), count(0) {}
51 			core::array< SFontArea >	areas;
52 			s32				start;
53 			s32				count;
54 		};*/
55 
56 
57 
58 		core::array<core::stringw>	FontNames;
59 		core::array<core::stringw>	CharSets;
60 		//core::array<SFontMap>		Mappings;
61 		core::array<SFontArea>		Areas;
62 		core::map<wchar_t, u32>		CharMap;
63 
64 		core::array<video::ITexture*>	currentTextures;
65 		core::array<video::IImage*>	currentImages;
66 		const int			*FontSizes;
67 		IrrlichtDevice			*Device;
68 
69 		bool UseAlphaChannel;
70 
71 		// windows
72 		#ifdef _IRR_WINDOWS_
73 		HDC dc;
74 		#endif
75 
76 	};
77 }
78 #endif // __IRR_FONT_TOOL_INCLUDED__
79