Rev 2 | Rev 4 | Go to most recent revision | Details | Compare with Previous | 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 |
||
| 3 | mjames | 13 | getPixel (char c, int x, int y) =0 ; |
| 2 | mjames | 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 | class font5x7_t : public font_t |
||
| 36 | { |
||
| 37 | public: |
||
| 38 | font5x7_t (char const *data) : |
||
| 39 | font_t (7, 5, data) |
||
| 40 | { |
||
| 41 | } |
||
| 42 | ; |
||
| 43 | |||
| 44 | char |
||
| 3 | mjames | 45 | getPixel (char c, int x, int y) override; |
| 2 | mjames | 46 | |
| 47 | }; |
||
| 48 | |||
| 49 | class font10x18_t : public font_t |
||
| 50 | { |
||
| 51 | public: |
||
| 52 | font10x18_t (char const *data) : |
||
| 53 | font_t (18, 10,data) |
||
| 54 | { |
||
| 55 | } |
||
| 56 | ; |
||
| 57 | |||
| 58 | char |
||
| 3 | mjames | 59 | getPixel (char c, int x, int y) override; |
| 2 | mjames | 60 | }; |
| 61 | |||
| 62 | // defined fonts |
||
| 63 | // original 5x7 |
||
| 64 | extern font5x7_t small_font; |
||
| 65 | |||
| 66 | // lucida font |
||
| 67 | // in 10x18 |
||
| 68 | extern font10x18_t large_font; |