Rev 3 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | // font class library |
2 | #pragma once |
||
3 | |||
4 | class font_t |
||
5 | { |
||
6 | public: |
||
7 | font_t (int const height, int const width, char const * data) : |
||
8 | m_height (height), m_width (width), m_data(data) |
||
9 | { |
||
10 | } |
||
11 | |||
12 | virtual char |
||
13 | get_pixel (char c, int x, int y) =0 ; |
||
14 | |||
15 | // character width |
||
16 | int |
||
17 | width () |
||
18 | { |
||
19 | return m_width; |
||
20 | } |
||
21 | |||
22 | // character height |
||
23 | int |
||
24 | height () |
||
25 | { |
||
26 | return m_height; |
||
27 | } |
||
28 | |||
29 | protected: |
||
30 | int const m_height; |
||
31 | int const m_width; |
||
32 | char const *m_data; |
||
33 | |||
34 | }; |
||
35 | |||
36 | class font5x7_t : public font_t |
||
37 | { |
||
38 | public: |
||
39 | font5x7_t (char const *data) : |
||
40 | font_t (7, 5, data) |
||
41 | { |
||
42 | } |
||
43 | ; |
||
44 | |||
45 | char |
||
46 | get_pixel (char c, int x, int y) override; |
||
47 | |||
48 | }; |
||
49 | |||
50 | class font10x18_t : public font_t |
||
51 | { |
||
52 | public: |
||
53 | font10x18_t (char const *data) : |
||
54 | font_t (18, 10,data) |
||
55 | { |
||
56 | } |
||
57 | ; |
||
58 | |||
59 | char |
||
60 | get_pixel (char c, int x, int y) override; |
||
61 | }; |
||
62 | |||
63 | // defined fonts |
||
64 | // original 5x7 |
||
65 | extern font5x7_t small_font; |
||
66 | |||
67 | // lucida font |
||
68 | // in 10x18 |
||
69 | extern font10x18_t large_font; |