TinyGPU
Loading...
Searching...
No Matches
Font5x7.h
Go to the documentation of this file.
1#pragma once
2
3#include <stddef.h>
4#include <stdint.h>
5
6#include "TinyGPU/Color/RGB565.h"
7#include "TinyGPU/Color/RGB888.h"
8#include "TinyGPU/Font/BitmapFont.h"
9
10namespace tinygpu {
11
12/**
13 * @brief Fixed-size 5x7 bitmap font with ASCII and extended character support.
14 *
15 * Built on BitmapFont<5, 7, uint8_t, RGB_T> for glyph storage, pixel
16 * lookup, drawing, and text measurement - this class only adds its own
17 * built-in glyph table (the 95 printable ASCII characters) and a fallback
18 * lookup for codepoints outside that contiguous range (Latin-1/CP1252-ish
19 * accented/currency/symbol characters, mapped either to a purpose-built
20 * glyph or to the closest plain ASCII character), by overriding glyph().
21 */
22template <typename RGB_T = RGB565>
23class Font5x7 : public BitmapFont<5, 7, uint8_t, RGB_T> {
24 using Base = BitmapFont<5, 7, uint8_t, RGB_T>;
25
26 public:
27 using Glyph = typename Base::Glyph;
28 using CodePoint = typename Base::CodePoint;
29
30 /// First directly stored ASCII character.
31 static constexpr char kFirstChar = ' ';
32 /// Last directly stored ASCII character.
33 static constexpr char kLastChar = '~';
34
35 /// Creates a Font5x7 instance.
37 : Base(glyphTable(),
38 static_cast<size_t>(kLastChar - kFirstChar + 1), kFirstChar) {}
39
40 /// Returns the glyph for a Unicode code point: the built-in extended
41 /// mapping (see glyphForExtendedCodePoint()) for codepoints outside the
42 /// directly-stored ASCII range, otherwise Base's own table lookup (which
43 /// itself falls back to '?' for anything unmapped).
44 const Glyph& glyph(CodePoint codePoint) const override {
45 const Glyph* mappedGlyph = glyphForExtendedCodePoint(codePoint);
46 return mappedGlyph != nullptr ? *mappedGlyph : Base::glyph(codePoint);
47 }
48 using Base::glyph; // un-hide the char overload (see IFont-style hiding
49 // rule: declaring glyph(CodePoint) above hides every
50 // base overload of that name unless re-exposed).
51
52 private:
53 const Glyph* asciiGlyphPtr(char character) const {
54 return &Base::glyph(character);
55 }
56
57 const Glyph* glyphForExtendedCodePoint(CodePoint codePoint) const {
58 switch (codePoint) {
59 case 0x80:
60 case 0x20AC:
61 return &euroGlyph();
62 case 0x82:
63 case 0x201A:
64 return asciiGlyphPtr(',');
65 case 0x83:
66 case 0x0192:
67 return asciiGlyphPtr('f');
68 case 0x84:
69 case 0x201E:
70 return asciiGlyphPtr('"');
71 case 0x85:
72 case 0x2026:
73 return asciiGlyphPtr('.');
74 case 0x86:
75 case 0x2020:
76 case 0x87:
77 case 0x2021:
78 return asciiGlyphPtr('+');
79 case 0x88:
80 case 0x02C6:
81 return asciiGlyphPtr('^');
82 case 0x89:
83 case 0x2030:
84 return asciiGlyphPtr('%');
85 case 0x8A:
86 case 0x0160:
87 return asciiGlyphPtr('S');
88 case 0x8B:
89 case 0x2039:
90 return asciiGlyphPtr('<');
91 case 0x8C:
92 case 0x0152:
93 return asciiGlyphPtr('O');
94 case 0x8E:
95 case 0x017D:
96 return asciiGlyphPtr('Z');
97 case 0x91:
98 case 0x2018:
99 case 0x92:
100 case 0x2019:
101 return asciiGlyphPtr('\'');
102 case 0x93:
103 case 0x201C:
104 case 0x94:
105 case 0x201D:
106 return asciiGlyphPtr('"');
107 case 0x95:
108 case 0x2022:
109 return bulletGlyphPtr();
110 case 0x96:
111 case 0x2013:
112 case 0x97:
113 case 0x2014:
114 return asciiGlyphPtr('-');
115 case 0x98:
116 case 0x02DC:
117 return asciiGlyphPtr('~');
118 case 0x99:
119 case 0x2122:
120 return asciiGlyphPtr('T');
121 case 0x9A:
122 case 0x0161:
123 return asciiGlyphPtr('s');
124 case 0x9B:
125 case 0x203A:
126 return asciiGlyphPtr('>');
127 case 0x9C:
128 case 0x0153:
129 return asciiGlyphPtr('o');
130 case 0x9E:
131 case 0x017E:
132 return asciiGlyphPtr('z');
133 case 0x9F:
134 case 0x0178:
135 return asciiGlyphPtr('Y');
136 case 0xA0:
137 return asciiGlyphPtr(' ');
138 case 0xA1:
139 return asciiGlyphPtr('!');
140 case 0xA2:
141 return &centGlyph();
142 case 0xA3:
143 return &sterlingGlyph();
144 case 0xA4:
145 return asciiGlyphPtr('$');
146 case 0xA5:
147 return &yenGlyph();
148 case 0xA6:
149 return asciiGlyphPtr('|');
150 case 0xA7:
151 return &sectionGlyph();
152 case 0xA8:
153 return asciiGlyphPtr('"');
154 case 0xA9:
155 return &copyrightGlyph();
156 case 0xAA:
157 return asciiGlyphPtr('a');
158 case 0xAB:
159 return asciiGlyphPtr('<');
160 case 0xAC:
161 return &notGlyph();
162 case 0xAD:
163 return asciiGlyphPtr('-');
164 case 0xAE:
165 return asciiGlyphPtr('R');
166 case 0xAF:
167 return asciiGlyphPtr('-');
168 case 0xB0:
169 return &degreeGlyph();
170 case 0xB1:
171 return &plusMinusGlyph();
172 case 0xB2:
173 return asciiGlyphPtr('2');
174 case 0xB3:
175 return asciiGlyphPtr('3');
176 case 0xB4:
177 return asciiGlyphPtr('\'');
178 case 0xB5:
179 return &microGlyph();
180 case 0xB6:
181 return &paragraphGlyph();
182 case 0xB7:
183 return bulletGlyphPtr();
184 case 0xB8:
185 return asciiGlyphPtr(',');
186 case 0xB9:
187 return asciiGlyphPtr('1');
188 case 0xBA:
189 return asciiGlyphPtr('o');
190 case 0xBB:
191 return asciiGlyphPtr('>');
192 case 0xBC:
193 case 0xBD:
194 case 0xBE:
195 return asciiGlyphPtr('/');
196 case 0xBF:
197 return asciiGlyphPtr('?');
198 case 0xC0:
199 case 0xC1:
200 case 0xC2:
201 case 0xC3:
202 case 0xC4:
203 case 0xC5:
204 case 0xC6:
205 return asciiGlyphPtr('A');
206 case 0xC7:
207 return asciiGlyphPtr('C');
208 case 0xC8:
209 case 0xC9:
210 case 0xCA:
211 case 0xCB:
212 return asciiGlyphPtr('E');
213 case 0xCC:
214 case 0xCD:
215 case 0xCE:
216 case 0xCF:
217 return asciiGlyphPtr('I');
218 case 0xD0:
219 return asciiGlyphPtr('D');
220 case 0xD1:
221 return asciiGlyphPtr('N');
222 case 0xD2:
223 case 0xD3:
224 case 0xD4:
225 case 0xD5:
226 case 0xD6:
227 case 0xD8:
228 return asciiGlyphPtr('O');
229 case 0xD7:
230 return &multiplyGlyph();
231 case 0xD9:
232 case 0xDA:
233 case 0xDB:
234 case 0xDC:
235 return asciiGlyphPtr('U');
236 case 0xDD:
237 return asciiGlyphPtr('Y');
238 case 0xDE:
239 return asciiGlyphPtr('P');
240 case 0xDF:
241 return asciiGlyphPtr('B');
242 case 0xE0:
243 case 0xE1:
244 case 0xE2:
245 case 0xE3:
246 case 0xE4:
247 case 0xE5:
248 case 0xE6:
249 return asciiGlyphPtr('a');
250 case 0xE7:
251 return asciiGlyphPtr('c');
252 case 0xE8:
253 case 0xE9:
254 case 0xEA:
255 case 0xEB:
256 return asciiGlyphPtr('e');
257 case 0xEC:
258 case 0xED:
259 case 0xEE:
260 case 0xEF:
261 return asciiGlyphPtr('i');
262 case 0xF0:
263 return asciiGlyphPtr('d');
264 case 0xF1:
265 return asciiGlyphPtr('n');
266 case 0xF2:
267 case 0xF3:
268 case 0xF4:
269 case 0xF5:
270 case 0xF6:
271 case 0xF8:
272 return asciiGlyphPtr('o');
273 case 0xF7:
274 return &divideGlyph();
275 case 0xF9:
276 case 0xFA:
277 case 0xFB:
278 case 0xFC:
279 return asciiGlyphPtr('u');
280 case 0xFD:
281 case 0xFF:
282 return asciiGlyphPtr('y');
283 case 0xFE:
284 return asciiGlyphPtr('p');
285 default:
286 return nullptr;
287 }
288 }
289
290 const Glyph* bulletGlyphPtr() const {
291 static const Glyph glyph = {0b00000, 0b00100, 0b01110, 0b01110,
292 0b01110, 0b00100, 0b00000};
293 return &glyph;
294 }
295
296 const Glyph& euroGlyph() const {
297 static const Glyph glyph = {0b00110, 0b01001, 0b11100, 0b11110,
298 0b11100, 0b01001, 0b00110};
299 return glyph;
300 }
301
302 const Glyph& centGlyph() const {
303 static const Glyph glyph = {0b00100, 0b01110, 0b10100, 0b10000,
304 0b10100, 0b01110, 0b00100};
305 return glyph;
306 }
307
308 const Glyph& sterlingGlyph() const {
309 static const Glyph glyph = {0b00110, 0b01001, 0b01000, 0b11100,
310 0b01000, 0b11111, 0b01000};
311 return glyph;
312 }
313
314 const Glyph& yenGlyph() const {
315 static const Glyph glyph = {0b10001, 0b01010, 0b11111, 0b00100,
316 0b11111, 0b00100, 0b00100};
317 return glyph;
318 }
319
320 const Glyph& sectionGlyph() const {
321 static const Glyph glyph = {0b01110, 0b10000, 0b01100, 0b00010,
322 0b00110, 0b00001, 0b11110};
323 return glyph;
324 }
325
326 const Glyph& copyrightGlyph() const {
327 static const Glyph glyph = {0b01110, 0b10001, 0b10111, 0b10101,
328 0b10111, 0b10001, 0b01110};
329 return glyph;
330 }
331
332 const Glyph& notGlyph() const {
333 static const Glyph glyph = {0b00000, 0b00000, 0b11111, 0b00001,
334 0b00001, 0b00000, 0b00000};
335 return glyph;
336 }
337
338 const Glyph& degreeGlyph() const {
339 static const Glyph glyph = {0b00110, 0b01001, 0b01001, 0b00110,
340 0b00000, 0b00000, 0b00000};
341 return glyph;
342 }
343
344 const Glyph& plusMinusGlyph() const {
345 static const Glyph glyph = {0b00000, 0b00100, 0b00100, 0b11111,
346 0b00100, 0b11111, 0b00000};
347 return glyph;
348 }
349
350 const Glyph& microGlyph() const {
351 static const Glyph glyph = {0b10001, 0b10001, 0b10001, 0b10011,
352 0b01101, 0b10000, 0b10000};
353 return glyph;
354 }
355
356 const Glyph& paragraphGlyph() const {
357 static const Glyph glyph = {0b11110, 0b10110, 0b10110, 0b11110,
358 0b00100, 0b00100, 0b00100};
359 return glyph;
360 }
361
362 const Glyph& multiplyGlyph() const {
363 static const Glyph glyph = {0b00000, 0b10001, 0b01010, 0b00100,
364 0b01010, 0b10001, 0b00000};
365 return glyph;
366 }
367
368 const Glyph& divideGlyph() const {
369 static const Glyph glyph = {0b00000, 0b00100, 0b00000, 0b11111,
370 0b00000, 0b00100, 0b00000};
371 return glyph;
372 }
373
374 static const Glyph* glyphTable() {
375 static const Glyph kGlyphs[] = {
376 Glyph{0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000,
377 0b00000}, // ' '
378 Glyph{0b00100, 0b00100, 0b00100, 0b00100, 0b00100, 0b00000,
379 0b00100}, // '!'
380 Glyph{0b01010, 0b01010, 0b01010, 0b00000, 0b00000, 0b00000,
381 0b00000}, // '"'
382 Glyph{0b01010, 0b01010, 0b11111, 0b01010, 0b11111, 0b01010,
383 0b01010}, // '#'
384 Glyph{0b00100, 0b01111, 0b10100, 0b01110, 0b00101, 0b11110,
385 0b00100}, // '$'
386 Glyph{0b11001, 0b11010, 0b00100, 0b01000, 0b10110, 0b00110,
387 0b00000}, // '%'
388 Glyph{0b01100, 0b10010, 0b10100, 0b01000, 0b10101, 0b10010,
389 0b01101}, // '&'
390 Glyph{0b00100, 0b00100, 0b00100, 0b00000, 0b00000, 0b00000,
391 0b00000}, // '\''
392 Glyph{0b00010, 0b00100, 0b01000, 0b01000, 0b01000, 0b00100,
393 0b00010}, // '('
394 Glyph{0b01000, 0b00100, 0b00010, 0b00010, 0b00010, 0b00100,
395 0b01000}, // ')'
396 Glyph{0b00000, 0b10101, 0b01110, 0b11111, 0b01110, 0b10101,
397 0b00000}, // '*'
398 Glyph{0b00000, 0b00100, 0b00100, 0b11111, 0b00100, 0b00100,
399 0b00000}, // '+'
400 Glyph{0b00000, 0b00000, 0b00000, 0b00000, 0b00100, 0b00100,
401 0b01000}, // ','
402 Glyph{0b00000, 0b00000, 0b00000, 0b11111, 0b00000, 0b00000,
403 0b00000}, // '-'
404 Glyph{0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00100,
405 0b00100}, // '.'
406 Glyph{0b00001, 0b00010, 0b00100, 0b01000, 0b10000, 0b00000,
407 0b00000}, // '/'
408 Glyph{0b01110, 0b10001, 0b10011, 0b10101, 0b11001, 0b10001,
409 0b01110}, // '0'
410 Glyph{0b00100, 0b01100, 0b00100, 0b00100, 0b00100, 0b00100,
411 0b01110}, // '1'
412 Glyph{0b01110, 0b10001, 0b00001, 0b00010, 0b00100, 0b01000,
413 0b11111}, // '2'
414 Glyph{0b11110, 0b00001, 0b00001, 0b01110, 0b00001, 0b00001,
415 0b11110}, // '3'
416 Glyph{0b00010, 0b00110, 0b01010, 0b10010, 0b11111, 0b00010,
417 0b00010}, // '4'
418 Glyph{0b11111, 0b10000, 0b11110, 0b00001, 0b00001, 0b10001,
419 0b01110}, // '5'
420 Glyph{0b00110, 0b01000, 0b10000, 0b11110, 0b10001, 0b10001,
421 0b01110}, // '6'
422 Glyph{0b11111, 0b00001, 0b00010, 0b00100, 0b01000, 0b01000,
423 0b01000}, // '7'
424 Glyph{0b01110, 0b10001, 0b10001, 0b01110, 0b10001, 0b10001,
425 0b01110}, // '8'
426 Glyph{0b01110, 0b10001, 0b10001, 0b01111, 0b00001, 0b00010,
427 0b01100}, // '9'
428 Glyph{0b00000, 0b00100, 0b00100, 0b00000, 0b00100, 0b00100,
429 0b00000}, // ':'
430 Glyph{0b00000, 0b00100, 0b00100, 0b00000, 0b00100, 0b00100,
431 0b01000}, // ';'
432 Glyph{0b00010, 0b00100, 0b01000, 0b10000, 0b01000, 0b00100,
433 0b00010}, // '<'
434 Glyph{0b00000, 0b00000, 0b11111, 0b00000, 0b11111, 0b00000,
435 0b00000}, // '='
436 Glyph{0b01000, 0b00100, 0b00010, 0b00001, 0b00010, 0b00100,
437 0b01000}, // '>'
438 Glyph{0b01110, 0b10001, 0b00001, 0b00010, 0b00100, 0b00000,
439 0b00100}, // '?'
440 Glyph{0b01110, 0b10001, 0b00001, 0b01101, 0b10101, 0b10101,
441 0b01110}, // '@'
442 Glyph{0b01110, 0b10001, 0b10001, 0b11111, 0b10001, 0b10001,
443 0b10001}, // 'A'
444 Glyph{0b11110, 0b10001, 0b10001, 0b11110, 0b10001, 0b10001,
445 0b11110}, // 'B'
446 Glyph{0b01110, 0b10001, 0b10000, 0b10000, 0b10000, 0b10001,
447 0b01110}, // 'C'
448 Glyph{0b11100, 0b10010, 0b10001, 0b10001, 0b10001, 0b10010,
449 0b11100}, // 'D'
450 Glyph{0b11111, 0b10000, 0b10000, 0b11110, 0b10000, 0b10000,
451 0b11111}, // 'E'
452 Glyph{0b11111, 0b10000, 0b10000, 0b11110, 0b10000, 0b10000,
453 0b10000}, // 'F'
454 Glyph{0b01110, 0b10001, 0b10000, 0b10111, 0b10001, 0b10001,
455 0b01111}, // 'G'
456 Glyph{0b10001, 0b10001, 0b10001, 0b11111, 0b10001, 0b10001,
457 0b10001}, // 'H'
458 Glyph{0b01110, 0b00100, 0b00100, 0b00100, 0b00100, 0b00100,
459 0b01110}, // 'I'
460 Glyph{0b00001, 0b00001, 0b00001, 0b00001, 0b10001, 0b10001,
461 0b01110}, // 'J'
462 Glyph{0b10001, 0b10010, 0b10100, 0b11000, 0b10100, 0b10010,
463 0b10001}, // 'K'
464 Glyph{0b10000, 0b10000, 0b10000, 0b10000, 0b10000, 0b10000,
465 0b11111}, // 'L'
466 Glyph{0b10001, 0b11011, 0b10101, 0b10101, 0b10001, 0b10001,
467 0b10001}, // 'M'
468 Glyph{0b10001, 0b11001, 0b10101, 0b10011, 0b10001, 0b10001,
469 0b10001}, // 'N'
470 Glyph{0b01110, 0b10001, 0b10001, 0b10001, 0b10001, 0b10001,
471 0b01110}, // 'O'
472 Glyph{0b11110, 0b10001, 0b10001, 0b11110, 0b10000, 0b10000,
473 0b10000}, // 'P'
474 Glyph{0b01110, 0b10001, 0b10001, 0b10001, 0b10101, 0b10010,
475 0b01101}, // 'Q'
476 Glyph{0b11110, 0b10001, 0b10001, 0b11110, 0b10100, 0b10010,
477 0b10001}, // 'R'
478 Glyph{0b01111, 0b10000, 0b10000, 0b01110, 0b00001, 0b00001,
479 0b11110}, // 'S'
480 Glyph{0b11111, 0b00100, 0b00100, 0b00100, 0b00100, 0b00100,
481 0b00100}, // 'T'
482 Glyph{0b10001, 0b10001, 0b10001, 0b10001, 0b10001, 0b10001,
483 0b01110}, // 'U'
484 Glyph{0b10001, 0b10001, 0b10001, 0b10001, 0b10001, 0b01010,
485 0b00100}, // 'V'
486 Glyph{0b10001, 0b10001, 0b10001, 0b10101, 0b10101, 0b10101,
487 0b01010}, // 'W'
488 Glyph{0b10001, 0b10001, 0b01010, 0b00100, 0b01010, 0b10001,
489 0b10001}, // 'X'
490 Glyph{0b10001, 0b10001, 0b01010, 0b00100, 0b00100, 0b00100,
491 0b00100}, // 'Y'
492 Glyph{0b11111, 0b00001, 0b00010, 0b00100, 0b01000, 0b10000,
493 0b11111}, // 'Z'
494 Glyph{0b01110, 0b01000, 0b01000, 0b01000, 0b01000, 0b01000,
495 0b01110}, // '['
496 Glyph{0b10000, 0b01000, 0b00100, 0b00010, 0b00001, 0b00000,
497 0b00000}, // '\\'
498 Glyph{0b01110, 0b00010, 0b00010, 0b00010, 0b00010, 0b00010,
499 0b01110}, // ']'
500 Glyph{0b00100, 0b01010, 0b10001, 0b00000, 0b00000, 0b00000,
501 0b00000}, // '^'
502 Glyph{0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000,
503 0b11111}, // '_'
504 Glyph{0b01000, 0b00100, 0b00010, 0b00000, 0b00000, 0b00000,
505 0b00000}, // '`'
506 Glyph{0b00000, 0b00000, 0b01110, 0b00001, 0b01111, 0b10001,
507 0b01111}, // 'a'
508 Glyph{0b10000, 0b10000, 0b10110, 0b11001, 0b10001, 0b10001,
509 0b11110}, // 'b'
510 Glyph{0b00000, 0b00000, 0b01110, 0b10000, 0b10000, 0b10001,
511 0b01110}, // 'c'
512 Glyph{0b00001, 0b00001, 0b01101, 0b10011, 0b10001, 0b10001,
513 0b01111}, // 'd'
514 Glyph{0b00000, 0b00000, 0b01110, 0b10001, 0b11111, 0b10000,
515 0b01110}, // 'e'
516 Glyph{0b00110, 0b01001, 0b01000, 0b11100, 0b01000, 0b01000,
517 0b01000}, // 'f'
518 Glyph{0b00000, 0b00000, 0b01111, 0b10001, 0b10001, 0b01111,
519 0b00001}, // 'g'
520 Glyph{0b10000, 0b10000, 0b10110, 0b11001, 0b10001, 0b10001,
521 0b10001}, // 'h'
522 Glyph{0b00100, 0b00000, 0b01100, 0b00100, 0b00100, 0b00100,
523 0b01110}, // 'i'
524 Glyph{0b00010, 0b00000, 0b00110, 0b00010, 0b00010, 0b10010,
525 0b01100}, // 'j'
526 Glyph{0b10000, 0b10000, 0b10010, 0b10100, 0b11000, 0b10100,
527 0b10010}, // 'k'
528 Glyph{0b01100, 0b00100, 0b00100, 0b00100, 0b00100, 0b00100,
529 0b01110}, // 'l'
530 Glyph{0b00000, 0b00000, 0b11010, 0b10101, 0b10101, 0b10101,
531 0b10101}, // 'm'
532 Glyph{0b00000, 0b00000, 0b10110, 0b11001, 0b10001, 0b10001,
533 0b10001}, // 'n'
534 Glyph{0b00000, 0b00000, 0b01110, 0b10001, 0b10001, 0b10001,
535 0b01110}, // 'o'
536 Glyph{0b00000, 0b00000, 0b11110, 0b10001, 0b11110, 0b10000,
537 0b10000}, // 'p'
538 Glyph{0b00000, 0b00000, 0b01101, 0b10001, 0b01111, 0b00001,
539 0b00001}, // 'q'
540 Glyph{0b00000, 0b00000, 0b10110, 0b11001, 0b10000, 0b10000,
541 0b10000}, // 'r'
542 Glyph{0b00000, 0b00000, 0b01111, 0b10000, 0b01110, 0b00001,
543 0b11110}, // 's'
544 Glyph{0b01000, 0b01000, 0b11100, 0b01000, 0b01000, 0b01001,
545 0b00110}, // 't'
546 Glyph{0b00000, 0b00000, 0b10001, 0b10001, 0b10001, 0b10011,
547 0b01101}, // 'u'
548 Glyph{0b00000, 0b00000, 0b10001, 0b10001, 0b10001, 0b01010,
549 0b00100}, // 'v'
550 Glyph{0b00000, 0b00000, 0b10001, 0b10001, 0b10101, 0b10101,
551 0b01010}, // 'w'
552 Glyph{0b00000, 0b00000, 0b10001, 0b01010, 0b00100, 0b01010,
553 0b10001}, // 'x'
554 Glyph{0b00000, 0b00000, 0b10001, 0b10001, 0b01111, 0b00001,
555 0b11110}, // 'y'
556 Glyph{0b00000, 0b00000, 0b11111, 0b00010, 0b00100, 0b01000,
557 0b11111}, // 'z'
558 Glyph{0b00010, 0b00100, 0b00100, 0b01000, 0b00100, 0b00100,
559 0b00010}, // '{'
560 Glyph{0b00100, 0b00100, 0b00100, 0b00100, 0b00100, 0b00100,
561 0b00100}, // '|'
562 Glyph{0b01000, 0b00100, 0b00100, 0b00010, 0b00100, 0b00100,
563 0b01000}, // '}'
564 Glyph{0b00000, 0b00000, 0b01001, 0b10110, 0b00000, 0b00000,
565 0b00000}, // '~'
566 };
567
568 return kGlyphs;
569 }
570};
571
572} // namespace tinygpu
Fixed-size bitmap font backed by a caller-supplied glyph table.
Definition: BitmapFont.h:30
Fixed-size 5x7 bitmap font with ASCII and extended character support.
Definition: Font5x7.h:23
static constexpr char kLastChar
Last directly stored ASCII character.
Definition: Font5x7.h:33
static constexpr char kFirstChar
First directly stored ASCII character.
Definition: Font5x7.h:31
const Glyph & glyph(CodePoint codePoint) const override
Definition: Font5x7.h:44
Font5x7()
Creates a Font5x7 instance.
Definition: Font5x7.h:36
RGB color stored in 16-bit RGB565 format, byte-swapped from the conventional bit layout.
Definition: RGB565.h:24
Definition: DSIBusESP32.h:19