fix some font alloc stuff
This commit is contained in:
@@ -2543,6 +2543,7 @@ void TFT_eSPI::loadFont(const uint8_t array[], uint8_t font) {
|
|||||||
gFonts[font].spaceWidth = gFonts[font].yAdvance / 4;
|
gFonts[font].spaceWidth = gFonts[font].yAdvance / 4;
|
||||||
|
|
||||||
loadMetrics(font);
|
loadMetrics(font);
|
||||||
|
fontOwned[font] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_eSPI::loadMetrics(uint8_t font)
|
void TFT_eSPI::loadMetrics(uint8_t font)
|
||||||
|
|||||||
+7
-13
@@ -401,23 +401,17 @@ class TFT_eSPI { friend class TFT_eSprite;
|
|||||||
} fontMetrics;
|
} fontMetrics;
|
||||||
|
|
||||||
fontMetrics gFonts[FONT_COUNT] = {
|
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 },
|
|
||||||
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
|
|
||||||
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
|
|
||||||
{ nullptr, 0, 0, 0, 0, 0, 0, 0 },
|
|
||||||
{ nullptr, 0, 0, 0, 0, 0, 0, 0 }
|
{ nullptr, 0, 0, 0, 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
// These are for the metrics for each individual glyph (so we don't need to seek this in file and waste time)
|
// 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[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //UTF-16 code, the codes are searched so do not need to be sequential
|
uint16_t* gUnicode[FONT_COUNT] = {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* gHeight[FONT_COUNT] = {NULL}; //cheight
|
||||||
uint8_t* gWidth[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //cwidth
|
uint8_t* gWidth[FONT_COUNT] = {NULL}; //cwidth
|
||||||
uint8_t* gxAdvance[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL}; //setWidth
|
uint8_t* gxAdvance[FONT_COUNT] = {NULL}; //setWidth
|
||||||
int16_t* gdY[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //topExtent
|
int16_t* gdY[FONT_COUNT] = {NULL}; //topExtent
|
||||||
int8_t* gdX[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //leftExtent
|
int8_t* gdX[FONT_COUNT] = {NULL}; //leftExtent
|
||||||
uint32_t* gBitmap[FONT_COUNT] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; //file pointer to greyscale bitmap
|
uint32_t* gBitmap[FONT_COUNT] = {NULL}; //file pointer to greyscale bitmap
|
||||||
|
|
||||||
bool fontOwned[FONT_COUNT] = {false};
|
bool fontOwned[FONT_COUNT] = {false};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user