Rev 4 | Rev 17 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4 | Rev 13 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | /// \param height - pixel character height |
8 | /// \param height - pixel character height |
9 | /// \param width - pixel character width |
9 | /// \param width - pixel character width |
10 | /// \param spacing - character to character spacing |
10 | /// \param spacing - character to character spacing |
11 | /// \param chars - number of characters in character set |
11 | /// \param chars - number of characters in character set |
12 | /// \param data - constant data |
12 | /// \param data - constant data |
13 | font_t (uint8_t const height, uint8_t const width, |
13 | font_t(uint8_t const height, uint8_t const width, |
14 | uint8_t const spacing, uint8_t const chars, |
14 | uint8_t const spacing, uint8_t const chars, |
15 | char const *data) : |
- | |
16 | m_height (height), m_width (width), m_spacing (spacing), m_chars (chars), m_data ( |
15 | char const *data) : m_height(height), m_width(width), m_spacing(spacing), m_chars(chars), m_data(data) |
17 | data) |
- | |
18 | { |
16 | { |
19 | } |
17 | } |
20 | 18 | ||
21 | virtual char |
19 | virtual char |
22 | getPixel (char c, int x, int y) =0; |
20 | getPixel(char c, int x, int y) = 0; |
23 | 21 | ||
24 | // character width |
22 | // character width |
25 | uint8_t |
23 | uint8_t |
26 | width () |
24 | width() |
27 | { |
25 | { |
28 | return m_width; |
26 | return m_width; |
29 | } |
27 | } |
30 | 28 | ||
31 | // character height |
29 | // character height |
32 | uint8_t |
30 | uint8_t |
33 | height () |
31 | height() |
34 | { |
32 | { |
35 | return m_height; |
33 | return m_height; |
36 | } |
34 | } |
37 | 35 | ||
38 | uint8_t |
36 | uint8_t |
39 | chars () |
37 | chars() |
40 | { |
38 | { |
41 | return m_chars; |
39 | return m_chars; |
42 | } |
40 | } |
43 | 41 | ||
44 | uint8_t |
42 | uint8_t |
45 | spacing () |
43 | spacing() |
46 | { |
44 | { |
47 | return m_spacing; |
45 | return m_spacing; |
48 | } |
46 | } |
- | 47 | ||
49 | protected: |
48 | protected: |
- | 49 | /// @brief Pixel height |
|
50 | uint8_t const m_height; |
50 | uint8_t const m_height; |
- | 51 | /// @brief Bitmap width |
|
51 | uint8_t const m_width; |
52 | uint8_t const m_width; |
- | 53 | /// @brief Spacing between characters |
|
52 | uint8_t const m_spacing; |
54 | uint8_t const m_spacing; |
- | 55 | /// @brief Number of characters in the character set bit map |
|
53 | uint8_t const m_chars; |
56 | uint8_t const m_chars; |
54 | char const *m_data; |
57 | char const *m_data; |
55 | }; |
58 | }; |
56 | 59 | ||
57 | class font5x7_t : public font_t |
60 | class font5x7_t : public font_t |
58 | { |
61 | { |
59 | public: |
62 | public: |
60 | font5x7_t (char const *data) : |
63 | // one byte of pixels per character row. |
61 | font_t (7, 5, 6, 96, data) |
64 | font5x7_t(unsigned char_count, char const *data) : font_t(7, 5, 6, char_count, data){}; |
62 | { |
- | |
63 | } |
- | |
64 | ; |
- | |
65 | 65 | ||
66 | char |
66 | char |
67 | getPixel (char c, int x, int y) override; |
67 | getPixel(char c, int x, int y) override; |
68 | - | ||
69 | }; |
68 | }; |
70 | 69 | ||
71 | class font10x18_t : public font_t |
70 | class font10x18_t : public font_t |
72 | { |
71 | { |
73 | public: |
72 | public: |
74 | font10x18_t (char const *data) : |
73 | // XBM format |
75 | font_t (18, 10, 10, 96, data) |
74 | font10x18_t(unsigned char_count, char const *data) : font_t(18, 10, 10, char_count, data){}; |
76 | { |
- | |
77 | } |
- | |
78 | ; |
- | |
79 | 75 | ||
80 | char |
76 | char |
81 | getPixel (char c, int x, int y) override; |
77 | getPixel(char c, int x, int y) override; |
82 | }; |
78 | }; |
83 | 79 | ||
84 | // defined fonts |
80 | // defined fonts |
85 | // original 5x7 |
81 | // original 5x7 |
86 | extern font5x7_t small_font; |
82 | extern font5x7_t small_font; |