ESP32 e-Paper info screen (client part).
[weathermon.git] / weather_screen / fonts.h
1 typedef struct {
2   int maxSize;
3   const uint8_t* u8g2;
4 } FontInfo;
5
6 #define CyrFonts 4
7
8 const FontInfo CyrFontArray[CyrFonts] = {
9   { 5, u8g2_font_4x6_t_cyrillic },
10   { 9, u8g2_font_6x13_t_cyrillic },
11   { 12, u8g2_font_9x15_t_cyrillic },
12   { 24, u8g2_font_inr24_t_cyrillic },
13 };
14
15 #define NumFonts 8
16
17 const FontInfo NumFontArray[NumFonts] = {
18   { 5, u8g2_font_4x6_t_cyrillic },
19   { 9, u8g2_font_6x13_t_cyrillic },
20   { 12, u8g2_font_9x15_t_cyrillic },
21   { 16, u8g2_font_logisoso16_tf },
22   { 24, u8g2_font_logisoso24_tf },
23   { 32, u8g2_font_logisoso32_tf },
24   { 50, u8g2_font_logisoso50_tf },
25   { 92, u8g2_font_logisoso92_tn }
26 };
27
28 void SetCyrFont(byte size) {
29   for (byte i=0; i<CyrFonts; i++) {
30     if (CyrFontArray[i].maxSize<size) u8g2Fonts.setFont(CyrFontArray[i].u8g2);
31   }
32 };
33
34 void SetNumFont(byte size) {
35   for (byte i=0; i<NumFonts; i++) {
36     if (NumFontArray[i].maxSize<size) u8g2Fonts.setFont(NumFontArray[i].u8g2);
37   }
38 };
39
40