summaryrefslogtreecommitdiff
path: root/src/font.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/font.h')
-rw-r--r--src/font.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/font.h b/src/font.h
new file mode 100644
index 0000000..802de9d
--- /dev/null
+++ b/src/font.h
@@ -0,0 +1,65 @@
1#ifndef FONT_H
2#define FONT_H
3
4#include <stdint.h>
5
6class Font
7{
8public:
9 class Point
10 {
11 public:
12 int32_t x, y;
13 };
14
15 class Glyph
16 {
17 public:
18 Glyph() :
19 pData( NULL )
20 { }
21 ~Glyph()
22 { delete[] pData; }
23 Point pBox;
24 Point pOff;
25 Point pDevOff;
26
27 int iRowBytes;
28 uint8_t *pData;
29 };
30
31public:
32 Font( const char *sSrcFile );
33 virtual ~Font();
34
35 Glyph *get( char c ) { return pTable[(int32_t)c]; }
36
37private:
38 Point pDefBox;
39 Point pDefOff;
40 int32_t iTableTop;
41 Glyph **pTable;
42
43private: // Parser
44 class Parser
45 {
46 public:
47 Parser( const char *sSrcFile, Font &rFont );
48 ~Parser();
49
50 void parse();
51 void getLine();
52 void header();
53 void properties();
54 void characters();
55 void character();
56
57 private:
58 Font &rFont;
59 void *rawfh;
60 char *sLine;
61 bool bDone;
62 };
63};
64
65#endif