Partially rework fonts (again)

This commit is contained in:
2026-02-13 23:57:42 +01:00
parent 2d03316910
commit 3668854cd4
12 changed files with 324 additions and 277 deletions
+13 -8
View File
@@ -1,5 +1,7 @@
#pragma once
#define FONT_COUNT 7
#include <Arduino.h>
#define SPI_FREQUENCY 7500000
@@ -398,7 +400,7 @@ class TFT_eSPI { friend class TFT_eSprite;
uint16_t maxDescent; // Maximum descent found in font
} fontMetrics;
fontMetrics gFonts[7] = {
fontMetrics gFonts[FONT_COUNT] = {
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
@@ -409,13 +411,15 @@ class TFT_eSPI { friend class TFT_eSprite;
};
// 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[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //UTF-16 code, the codes are searched so do not need to be sequential
uint8_t* gHeight[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //cheight
uint8_t* gWidth[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //cwidth
uint8_t* gxAdvance[7] = {NULL, NULL, NULL, NULL, NULL, NULL}; //setWidth
int16_t* gdY[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //topExtent
int8_t* gdX[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //leftExtent
uint32_t* gBitmap[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //file pointer to greyscale bitmap
uint16_t* gUnicode[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //UTF-16 code, the codes are searched so do not need to be sequential
uint8_t* gHeight[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //cheight
uint8_t* gWidth[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //cwidth
uint8_t* gxAdvance[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL}; //setWidth
int16_t* gdY[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //topExtent
int8_t* gdX[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //leftExtent
uint32_t* gBitmap[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //file pointer to greyscale bitmap
bool fontOwned[FONT_COUNT] = {false};
uint8_t getTouchRaw(uint16_t *x, uint16_t *y);
uint16_t getTouchRawZ();
@@ -539,6 +543,7 @@ class TFT_eSprite : public TFT_eSPI {
int16_t width(),
height();
void drawGlyph(uint16_t code, uint16_t font);
void copyFontFromTFT(uint8_t source, uint8_t destination);
private: