-
-
Notifications
You must be signed in to change notification settings - Fork 191
/
lgfx_fonts.hpp
498 lines (439 loc) · 20.7 KB
/
lgfx_fonts.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
#ifndef LGFX_FONTS_HPP_
#define LGFX_FONTS_HPP_
#include <stdint.h>
#include <stddef.h>
#include "misc/enum.hpp"
#include "../utility/pgmspace.h"
namespace lgfx
{
inline namespace v1
{
class LGFXBase;
struct DataWrapper;
struct IFont;
struct FontMetrics;
struct TextStyle;
struct IFont
{
enum font_type_t
{ ft_unknown
, ft_glcd
, ft_bmp
, ft_rle
, ft_gfx
, ft_bdf
, ft_vlw
, ft_u8g2
, ft_ttf
};
virtual font_type_t getType(void) const { return font_type_t::ft_unknown; }
virtual void getDefaultMetric(FontMetrics *metrics) const = 0;
virtual bool updateFontMetric(FontMetrics *metrics, uint16_t uniCode) const = 0;
virtual bool unloadFont(void) { return false; }
virtual size_t drawChar(LGFXBase* gfx, int32_t x, int32_t y, uint16_t c, const TextStyle* style, FontMetrics* metrics, int32_t& filled_x) const = 0;
protected:
size_t drawCharDummy(LGFXBase* gfx, int32_t x, int32_t y, int32_t w, int32_t h, const TextStyle* style, int32_t& filled_x) const;
};
struct BaseFont : public IFont {
union
{
const void *void_chartbl;
const uint8_t *chartbl;
};
const uint8_t *widthtbl;
const uint8_t width;
const uint8_t height;
const uint8_t baseline;
BaseFont() = default;
constexpr BaseFont(const void *chartbl, const uint8_t *widthtbl, uint8_t width, uint8_t height, uint8_t baseline)
: void_chartbl(chartbl )
, widthtbl (widthtbl )
, width (width )
, height (height )
, baseline (baseline )
{}
void getDefaultMetric(FontMetrics *metrics) const override;
};
struct GLCDfont : public BaseFont {
constexpr GLCDfont(const void *chartbl, const uint8_t *widthtbl, uint8_t width, uint8_t height, uint8_t baseline) : BaseFont(chartbl, widthtbl, width, height, baseline ) {}
font_type_t getType(void) const override { return ft_glcd; }
bool updateFontMetric(FontMetrics *metrics, uint16_t uniCode) const override;
size_t drawChar(LGFXBase* gfx, int32_t x, int32_t y, uint16_t c, const TextStyle* style, FontMetrics* metrics, int32_t& filled_x) const override;
};
struct FixedBMPfont : public BaseFont {
constexpr FixedBMPfont(const void *chartbl, const uint8_t *widthtbl, uint8_t width, uint8_t height, uint8_t baseline) : BaseFont(chartbl, widthtbl, width, height, baseline ) {}
font_type_t getType(void) const override { return ft_bmp; }
bool updateFontMetric(FontMetrics *metrics, uint16_t uniCode) const override;
size_t drawChar(LGFXBase* gfx, int32_t x, int32_t y, uint16_t c, const TextStyle* style, FontMetrics* metrics, int32_t& filled_x) const override;
};
struct BMPfont : public BaseFont {
constexpr BMPfont(const void *chartbl, const uint8_t *widthtbl, uint8_t width, uint8_t height, uint8_t baseline) : BaseFont(chartbl, widthtbl, width, height, baseline ) {}
font_type_t getType(void) const override { return ft_bmp; }
bool updateFontMetric(FontMetrics *metrics, uint16_t uniCode) const override;
size_t drawChar(LGFXBase* gfx, int32_t x, int32_t y, uint16_t c, const TextStyle* style, FontMetrics* metrics, int32_t& filled_x) const override;
};
struct RLEfont : public BMPfont {
constexpr RLEfont(const void *chartbl, const uint8_t *widthtbl, uint8_t width, uint8_t height, uint8_t baseline) : BMPfont(chartbl, widthtbl, width, height, baseline ) {}
font_type_t getType(void) const override { return ft_rle; }
size_t drawChar(LGFXBase* gfx, int32_t x, int32_t y, uint16_t c, const TextStyle* style, FontMetrics* metrics, int32_t& filled_x) const override;
};
struct BDFfont : public BaseFont {
const uint16_t *indextbl;
uint16_t indexsize;
uint8_t halfwidth;
uint8_t y_advance;
BDFfont() = default;
constexpr BDFfont(const void *chartbl, const uint16_t *indextbl, uint16_t indexsize, uint8_t width, uint8_t halfwidth, uint8_t height, uint8_t baseline, uint8_t y_advance)
: BaseFont(chartbl, nullptr, width, height, baseline )
, indextbl(indextbl)
, indexsize(indexsize)
, halfwidth(halfwidth)
, y_advance(y_advance)
{}
font_type_t getType(void) const override { return ft_bdf; }
void getDefaultMetric(FontMetrics *metrics) const override;
bool updateFontMetric(FontMetrics *metrics, uint16_t uniCode) const override;
size_t drawChar(LGFXBase* gfx, int32_t x, int32_t y, uint16_t c, const TextStyle* style, FontMetrics* metrics, int32_t& filled_x) const override;
};
// deprecated array.
extern const IFont* fontdata [];
//----------------------------------------------------------------------------
// Adafruit GFX font
struct EncodeRange {
uint16_t start;
uint16_t end;
uint16_t base;
};
struct GFXglyph { // Data stored PER GLYPH
uint32_t bitmapOffset; // Pointer into GFXfont->bitmap
uint8_t width, height; // Bitmap dimensions in pixels
uint8_t xAdvance; // Distance to advance cursor (x axis)
int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
};
struct GFXfont : public lgfx::IFont
{ // Data stored for FONT AS A WHOLE:
uint8_t *bitmap; // Glyph bitmaps, concatenated
GFXglyph *glyph; // Glyph array
uint16_t first, last; // ASCII extents
uint8_t yAdvance; // Newline distance (y axis)
uint16_t range_num; // Number of EncodeRange
EncodeRange *range; // Array ofEncodeRange
constexpr GFXfont ( uint8_t *bitmap
, GFXglyph *glyph
, uint16_t first
, uint16_t last
, uint8_t yAdvance
, uint16_t range_num = 0
, EncodeRange *range = nullptr
)
: bitmap (bitmap )
, glyph (glyph )
, first (first )
, last (last )
, yAdvance (yAdvance )
, range_num(range_num)
, range (range )
{}
font_type_t getType(void) const override { return font_type_t::ft_gfx; }
void getDefaultMetric(FontMetrics *metrics) const override;
bool updateFontMetric(FontMetrics *metrics, uint16_t uniCode) const override;
size_t drawChar(LGFXBase* gfx, int32_t x, int32_t y, uint16_t c, const TextStyle* style, FontMetrics* metrics, int32_t& filled_x) const override;
private:
GFXglyph* getGlyph(uint16_t uniCode) const;
};
//----------------------------------------------------------------------------
// u8g2 font
struct U8g2font : public lgfx::IFont
{
constexpr U8g2font(const uint8_t *u8g2_font) : _font(u8g2_font) {}
font_type_t getType(void) const override { return ft_u8g2; }
uint8_t glyph_cnt (void) const { return pgm_read_byte(&_font[0]); }
uint8_t bbx_mode (void) const { return pgm_read_byte(&_font[1]); }
uint8_t bits_per_0(void) const { return pgm_read_byte(&_font[2]); }
uint8_t bits_per_1(void) const { return pgm_read_byte(&_font[3]); }
uint8_t bits_per_char_width (void) const { return pgm_read_byte(&_font[4]); }
uint8_t bits_per_char_height(void) const { return pgm_read_byte(&_font[5]); }
uint8_t bits_per_char_x (void) const { return pgm_read_byte(&_font[6]); }
uint8_t bits_per_char_y (void) const { return pgm_read_byte(&_font[7]); }
uint8_t bits_per_delta_x (void) const { return pgm_read_byte(&_font[8]); }
int8_t max_char_width (void) const { return pgm_read_byte(&_font[ 9]); }
int8_t max_char_height(void) const { return pgm_read_byte(&_font[10]); } /* overall height, NOT ascent. Instead ascent = max_char_height + y_offset */
int8_t x_offset (void) const { return pgm_read_byte(&_font[11]); }
int8_t y_offset (void) const { return pgm_read_byte(&_font[12]); }
int8_t ascent_A (void) const { return pgm_read_byte(&_font[13]); }
int8_t descent_g (void) const { return pgm_read_byte(&_font[14]); } /* usually a negative value */
int8_t ascent_para (void) const { return pgm_read_byte(&_font[15]); }
int8_t descent_para(void) const { return pgm_read_byte(&_font[16]); }
uint16_t start_pos_upper_A(void) const { return pgm_read_byte(&_font[17]) << 8 | pgm_read_byte(&_font[18]); }
uint16_t start_pos_lower_a(void) const { return pgm_read_byte(&_font[19]) << 8 | pgm_read_byte(&_font[20]); }
uint16_t start_pos_unicode(void) const { return pgm_read_byte(&_font[21]) << 8 | pgm_read_byte(&_font[22]); }
void getDefaultMetric(FontMetrics *metrics) const override;
bool updateFontMetric(FontMetrics *metrics, uint16_t uniCode) const override;
size_t drawChar(LGFXBase* gfx, int32_t x, int32_t y, uint16_t c, const TextStyle* style, FontMetrics* metrics, int32_t& filled_x) const override;
private:
const uint8_t* getGlyph(uint16_t encoding) const;
const uint8_t* _font;
};
//----------------------------------------------------------------------------
struct RunTimeFont : public IFont
{
virtual ~RunTimeFont() = default;
virtual bool loadFont(DataWrapper* data) = 0;
DataWrapper* _fontData = nullptr;
bool _fontLoaded = false;
};
//----------------------------------------------------------------------------
// VLW font
struct VLWfont : public RunTimeFont
{
uint16_t gCount; // Total number of characters
uint16_t yAdvance; // Line advance
uint16_t spaceWidth; // Width of a space character
int16_t ascent; // Height of top of 'd' above baseline, other characters may be taller
int16_t descent; // Offset to bottom of 'p', other characters may have a larger descent
uint16_t maxAscent; // Maximum ascent found in font
uint16_t maxDescent; // Maximum descent found in font
// These are for the metrics for each individual glyph (so we don't need to seek this in file and waste time)
uint16_t* gUnicode = nullptr; //UTF-16 code, the codes are searched so do not need to be sequential
uint8_t* gWidth = nullptr; //cwidth
uint8_t* gxAdvance = nullptr; //setWidth
int8_t* gdX = nullptr; //leftExtent
uint32_t* gBitmap = nullptr; //file pointer to greyscale bitmap
font_type_t getType(void) const override { return ft_vlw; }
size_t drawChar(LGFXBase* gfx, int32_t x, int32_t y, uint16_t c, const TextStyle* style, FontMetrics* metrics, int32_t& filled_x) const override;
void getDefaultMetric(FontMetrics *metrics) const override;
virtual ~VLWfont();
bool loadFont(DataWrapper* data) override;
bool unloadFont(void) override;
bool updateFontMetric(FontMetrics *metrics, uint16_t uniCode) const override;
bool getUnicodeIndex(uint16_t unicode, uint16_t *index) const;
};
//----------------------------------------------------------------------------
namespace fonts
{
#ifdef __EFONT_FONT_DATA_H__
static constexpr lgfx::BDFfont efont = { (const uint8_t *)efontFontData, efontFontList, sizeof(efontFontList)>>1, 16, 8, 16, 14, 16 };
#endif
extern const lgfx::GLCDfont Font0;
extern const lgfx::BMPfont Font2;
extern const lgfx::RLEfont Font4;
extern const lgfx::RLEfont Font6;
extern const lgfx::RLEfont Font7;
extern const lgfx::RLEfont Font8;
extern const lgfx::GLCDfont Font8x8C64;
extern const lgfx::FixedBMPfont AsciiFont8x16;
extern const lgfx::FixedBMPfont AsciiFont24x48;
extern const lgfx::GFXfont TomThumb ;
extern const lgfx::GFXfont FreeMono9pt7b ;
extern const lgfx::GFXfont FreeMono12pt7b ;
extern const lgfx::GFXfont FreeMono18pt7b ;
extern const lgfx::GFXfont FreeMono24pt7b ;
extern const lgfx::GFXfont FreeMonoBold9pt7b ;
extern const lgfx::GFXfont FreeMonoBold12pt7b ;
extern const lgfx::GFXfont FreeMonoBold18pt7b ;
extern const lgfx::GFXfont FreeMonoBold24pt7b ;
extern const lgfx::GFXfont FreeMonoOblique9pt7b ;
extern const lgfx::GFXfont FreeMonoOblique12pt7b ;
extern const lgfx::GFXfont FreeMonoOblique18pt7b ;
extern const lgfx::GFXfont FreeMonoOblique24pt7b ;
extern const lgfx::GFXfont FreeMonoBoldOblique9pt7b ;
extern const lgfx::GFXfont FreeMonoBoldOblique12pt7b;
extern const lgfx::GFXfont FreeMonoBoldOblique18pt7b;
extern const lgfx::GFXfont FreeMonoBoldOblique24pt7b;
extern const lgfx::GFXfont FreeSans9pt7b ;
extern const lgfx::GFXfont FreeSans12pt7b ;
extern const lgfx::GFXfont FreeSans18pt7b ;
extern const lgfx::GFXfont FreeSans24pt7b ;
extern const lgfx::GFXfont FreeSansBold9pt7b ;
extern const lgfx::GFXfont FreeSansBold12pt7b ;
extern const lgfx::GFXfont FreeSansBold18pt7b ;
extern const lgfx::GFXfont FreeSansBold24pt7b ;
extern const lgfx::GFXfont FreeSansOblique9pt7b ;
extern const lgfx::GFXfont FreeSansOblique12pt7b ;
extern const lgfx::GFXfont FreeSansOblique18pt7b ;
extern const lgfx::GFXfont FreeSansOblique24pt7b ;
extern const lgfx::GFXfont FreeSansBoldOblique9pt7b ;
extern const lgfx::GFXfont FreeSansBoldOblique12pt7b;
extern const lgfx::GFXfont FreeSansBoldOblique18pt7b;
extern const lgfx::GFXfont FreeSansBoldOblique24pt7b;
extern const lgfx::GFXfont FreeSerif9pt7b ;
extern const lgfx::GFXfont FreeSerif12pt7b ;
extern const lgfx::GFXfont FreeSerif18pt7b ;
extern const lgfx::GFXfont FreeSerif24pt7b ;
extern const lgfx::GFXfont FreeSerifItalic9pt7b ;
extern const lgfx::GFXfont FreeSerifItalic12pt7b ;
extern const lgfx::GFXfont FreeSerifItalic18pt7b ;
extern const lgfx::GFXfont FreeSerifItalic24pt7b ;
extern const lgfx::GFXfont FreeSerifBold9pt7b ;
extern const lgfx::GFXfont FreeSerifBold12pt7b ;
extern const lgfx::GFXfont FreeSerifBold18pt7b ;
extern const lgfx::GFXfont FreeSerifBold24pt7b ;
extern const lgfx::GFXfont FreeSerifBoldItalic9pt7b ;
extern const lgfx::GFXfont FreeSerifBoldItalic12pt7b;
extern const lgfx::GFXfont FreeSerifBoldItalic18pt7b;
extern const lgfx::GFXfont FreeSerifBoldItalic24pt7b;
extern const lgfx::GFXfont Orbitron_Light_24;
extern const lgfx::GFXfont Orbitron_Light_32;
extern const lgfx::GFXfont Roboto_Thin_24 ;
extern const lgfx::GFXfont Satisfy_24 ;
extern const lgfx::GFXfont Yellowtail_32 ;
extern const lgfx::GFXfont DejaVu9 ;
extern const lgfx::GFXfont DejaVu12;
extern const lgfx::GFXfont DejaVu18;
extern const lgfx::GFXfont DejaVu24;
extern const lgfx::GFXfont DejaVu40;
extern const lgfx::GFXfont DejaVu56;
extern const lgfx::GFXfont DejaVu72;
extern const lgfx::U8g2font lgfxJapanMincho_8 ;
extern const lgfx::U8g2font lgfxJapanMincho_12 ;
extern const lgfx::U8g2font lgfxJapanMincho_16 ;
extern const lgfx::U8g2font lgfxJapanMincho_20 ;
extern const lgfx::U8g2font lgfxJapanMincho_24 ;
extern const lgfx::U8g2font lgfxJapanMincho_28 ;
extern const lgfx::U8g2font lgfxJapanMincho_32 ;
extern const lgfx::U8g2font lgfxJapanMincho_36 ;
extern const lgfx::U8g2font lgfxJapanMincho_40 ;
extern const lgfx::U8g2font lgfxJapanMinchoP_8 ;
extern const lgfx::U8g2font lgfxJapanMinchoP_12;
extern const lgfx::U8g2font lgfxJapanMinchoP_16;
extern const lgfx::U8g2font lgfxJapanMinchoP_20;
extern const lgfx::U8g2font lgfxJapanMinchoP_24;
extern const lgfx::U8g2font lgfxJapanMinchoP_28;
extern const lgfx::U8g2font lgfxJapanMinchoP_32;
extern const lgfx::U8g2font lgfxJapanMinchoP_36;
extern const lgfx::U8g2font lgfxJapanMinchoP_40;
extern const lgfx::U8g2font lgfxJapanGothic_8 ;
extern const lgfx::U8g2font lgfxJapanGothic_12 ;
extern const lgfx::U8g2font lgfxJapanGothic_16 ;
extern const lgfx::U8g2font lgfxJapanGothic_20 ;
extern const lgfx::U8g2font lgfxJapanGothic_24 ;
extern const lgfx::U8g2font lgfxJapanGothic_28 ;
extern const lgfx::U8g2font lgfxJapanGothic_32 ;
extern const lgfx::U8g2font lgfxJapanGothic_36 ;
extern const lgfx::U8g2font lgfxJapanGothic_40 ;
extern const lgfx::U8g2font lgfxJapanGothicP_8 ;
extern const lgfx::U8g2font lgfxJapanGothicP_12;
extern const lgfx::U8g2font lgfxJapanGothicP_16;
extern const lgfx::U8g2font lgfxJapanGothicP_20;
extern const lgfx::U8g2font lgfxJapanGothicP_24;
extern const lgfx::U8g2font lgfxJapanGothicP_28;
extern const lgfx::U8g2font lgfxJapanGothicP_32;
extern const lgfx::U8g2font lgfxJapanGothicP_36;
extern const lgfx::U8g2font lgfxJapanGothicP_40;
extern const lgfx::U8g2font efontCN_10 ;
extern const lgfx::U8g2font efontCN_10_b ;
extern const lgfx::U8g2font efontCN_10_bi;
extern const lgfx::U8g2font efontCN_10_i ;
extern const lgfx::U8g2font efontCN_12 ;
extern const lgfx::U8g2font efontCN_12_b ;
extern const lgfx::U8g2font efontCN_12_bi;
extern const lgfx::U8g2font efontCN_12_i ;
extern const lgfx::U8g2font efontCN_14 ;
extern const lgfx::U8g2font efontCN_14_b ;
extern const lgfx::U8g2font efontCN_14_bi;
extern const lgfx::U8g2font efontCN_14_i ;
extern const lgfx::U8g2font efontCN_16 ;
extern const lgfx::U8g2font efontCN_16_b ;
extern const lgfx::U8g2font efontCN_16_bi;
extern const lgfx::U8g2font efontCN_16_i ;
extern const lgfx::U8g2font efontCN_24 ;
extern const lgfx::U8g2font efontCN_24_b ;
extern const lgfx::U8g2font efontCN_24_bi;
extern const lgfx::U8g2font efontCN_24_i ;
extern const lgfx::U8g2font efontJA_10 ;
extern const lgfx::U8g2font efontJA_10_b ;
extern const lgfx::U8g2font efontJA_10_bi;
extern const lgfx::U8g2font efontJA_10_i ;
extern const lgfx::U8g2font efontJA_12 ;
extern const lgfx::U8g2font efontJA_12_b ;
extern const lgfx::U8g2font efontJA_12_bi;
extern const lgfx::U8g2font efontJA_12_i ;
extern const lgfx::U8g2font efontJA_14 ;
extern const lgfx::U8g2font efontJA_14_b ;
extern const lgfx::U8g2font efontJA_14_bi;
extern const lgfx::U8g2font efontJA_14_i ;
extern const lgfx::U8g2font efontJA_16 ;
extern const lgfx::U8g2font efontJA_16_b ;
extern const lgfx::U8g2font efontJA_16_bi;
extern const lgfx::U8g2font efontJA_16_i ;
extern const lgfx::U8g2font efontJA_24 ;
extern const lgfx::U8g2font efontJA_24_b ;
extern const lgfx::U8g2font efontJA_24_bi;
extern const lgfx::U8g2font efontJA_24_i ;
extern const lgfx::U8g2font efontKR_10 ;
extern const lgfx::U8g2font efontKR_10_b ;
extern const lgfx::U8g2font efontKR_10_bi;
extern const lgfx::U8g2font efontKR_10_i ;
extern const lgfx::U8g2font efontKR_12 ;
extern const lgfx::U8g2font efontKR_12_b ;
extern const lgfx::U8g2font efontKR_12_bi;
extern const lgfx::U8g2font efontKR_12_i ;
extern const lgfx::U8g2font efontKR_14 ;
extern const lgfx::U8g2font efontKR_14_b ;
extern const lgfx::U8g2font efontKR_14_bi;
extern const lgfx::U8g2font efontKR_14_i ;
extern const lgfx::U8g2font efontKR_16 ;
extern const lgfx::U8g2font efontKR_16_b ;
extern const lgfx::U8g2font efontKR_16_bi;
extern const lgfx::U8g2font efontKR_16_i ;
extern const lgfx::U8g2font efontKR_24 ;
extern const lgfx::U8g2font efontKR_24_b ;
extern const lgfx::U8g2font efontKR_24_bi;
extern const lgfx::U8g2font efontKR_24_i ;
extern const lgfx::U8g2font efontTW_10 ;
extern const lgfx::U8g2font efontTW_10_b ;
extern const lgfx::U8g2font efontTW_10_bi;
extern const lgfx::U8g2font efontTW_10_i ;
extern const lgfx::U8g2font efontTW_12 ;
extern const lgfx::U8g2font efontTW_12_b ;
extern const lgfx::U8g2font efontTW_12_bi;
extern const lgfx::U8g2font efontTW_12_i ;
extern const lgfx::U8g2font efontTW_14 ;
extern const lgfx::U8g2font efontTW_14_b ;
extern const lgfx::U8g2font efontTW_14_bi;
extern const lgfx::U8g2font efontTW_14_i ;
extern const lgfx::U8g2font efontTW_16 ;
extern const lgfx::U8g2font efontTW_16_b ;
extern const lgfx::U8g2font efontTW_16_bi;
extern const lgfx::U8g2font efontTW_16_i ;
extern const lgfx::U8g2font efontTW_24 ;
extern const lgfx::U8g2font efontTW_24_b ;
extern const lgfx::U8g2font efontTW_24_bi;
extern const lgfx::U8g2font efontTW_24_i ;
}
struct FontMetrics
{
int16_t width;
int16_t x_advance;
int16_t x_offset;
int16_t height;
int16_t y_advance;
int16_t y_offset;
int16_t baseline;
};
struct TextStyle
{
uint32_t fore_rgb888 = 0xFFFFFFU;
uint32_t back_rgb888 = 0;
float size_x = 1;
float size_y = 1;
textdatum_t datum = textdatum_t::top_left;
int32_t padding_x = 0;
bool utf8 = true;
bool cp437 = false;
// IFont* font = &fonts::Font0;
// FontMetrics metrics;
};
}
}
namespace fonts
{
using namespace lgfx::v1::fonts;
}
using namespace fonts;
#ifndef _GFXFONT_H_
#define _GFXFONT_H_
using GFXfont = lgfx::v1::GFXfont;
using GFXglyph = lgfx::v1::GFXglyph;
#endif
#endif