Avoid warnings if fonts disabled in setup

This commit is contained in:
Bodmer
2022-05-19 21:47:01 +01:00
parent bed65958e5
commit ba819765af
2 changed files with 46 additions and 8 deletions

View File

@ -2076,15 +2076,16 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
uint8_t w = pgm_read_byte(&glyph->width), uint8_t w = pgm_read_byte(&glyph->width),
h = pgm_read_byte(&glyph->height); h = pgm_read_byte(&glyph->height);
int8_t xo = pgm_read_byte(&glyph->xOffset),
yo = pgm_read_byte(&glyph->yOffset);
if (((x + w * size - 1) < (_vpX - _xDatum)) || // Clip left if (((x + xo + w * size - 1) < (_vpX - _xDatum)) || // Clip left
((y + h * size - 1) < (_vpY - _yDatum))) // Clip top ((y + yo + h * size - 1) < (_vpY - _yDatum))) // Clip top
return; return;
uint8_t *bitmap = (uint8_t *)pgm_read_dword(&gfxFont->bitmap); uint8_t *bitmap = (uint8_t *)pgm_read_dword(&gfxFont->bitmap);
uint32_t bo = pgm_read_word(&glyph->bitmapOffset); uint32_t bo = pgm_read_word(&glyph->bitmapOffset);
int8_t xo = pgm_read_byte(&glyph->xOffset),
yo = pgm_read_byte(&glyph->yOffset);
uint8_t xx, yy, bits=0, bit=0; uint8_t xx, yy, bits=0, bit=0;
//uint8_t xa = pgm_read_byte(&glyph->xAdvance); //uint8_t xa = pgm_read_byte(&glyph->xAdvance);
int16_t xo16 = 0, yo16 = 0; int16_t xo16 = 0, yo16 = 0;
@ -2126,6 +2127,12 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
#ifdef LOAD_GFXFF #ifdef LOAD_GFXFF
} // End classic vs custom font } // End classic vs custom font
#endif #endif
#else
#ifndef LOAD_GFXFF
color = color;
bg = bg;
size = size;
#endif
#endif #endif
} }
@ -2385,6 +2392,17 @@ int16_t TFT_eSprite::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t fo
} }
// End of RLE font rendering // End of RLE font rendering
#endif #endif
#if !defined (LOAD_FONT2) && !defined (LOAD_RLE)
// Stop warnings
flash_address = flash_address;
w = w;
pX = pX;
pY = pY;
line = line;
clip = clip;
#endif
return width * textsize; // x + return width * textsize; // x +
} }

View File

@ -473,7 +473,7 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h)
_cp437 = true; // Legacy GLCD font bug fix _cp437 = true; // Legacy GLCD font bug fix
_utf8 = true; // UTF8 decoding enabled _utf8 = true; // UTF8 decoding enabled
#ifdef FONT_FS_AVAILABLE #if defined (FONT_FS_AVAILABLE) && defined (SMOOTH_FONT)
fs_font = true; // Smooth font filing system or array (fs_font = false) flag fs_font = true; // Smooth font filing system or array (fs_font = false) flag
#endif #endif
@ -3016,9 +3016,6 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32
{ {
if (_vpOoB) return; if (_vpOoB) return;
int32_t xd = x + _xDatum;
int32_t yd = y + _yDatum;
if (c < 32) return; if (c < 32) return;
#ifdef LOAD_GLCD #ifdef LOAD_GLCD
//>>>>>>>>>>>>>>>>>> //>>>>>>>>>>>>>>>>>>
@ -3027,6 +3024,9 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32
#endif #endif
//>>>>>>>>>>>>>>>>>> //>>>>>>>>>>>>>>>>>>
int32_t xd = x + _xDatum;
int32_t yd = y + _yDatum;
if ((xd >= _vpW) || // Clip right if ((xd >= _vpW) || // Clip right
( yd >= _vpH) || // Clip bottom ( yd >= _vpH) || // Clip bottom
((xd + 6 * size - 1) < _vpX) || // Clip left ((xd + 6 * size - 1) < _vpX) || // Clip left
@ -3153,6 +3153,15 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32
#ifdef LOAD_GFXFF #ifdef LOAD_GFXFF
} // End classic vs custom font } // End classic vs custom font
#endif #endif
#else
#ifndef LOAD_GFXFF
// Avoid warnings if fonts are disabled
x = x;
y = y;
color = color;
bg = bg;
size = size;
#endif
#endif #endif
} }
@ -4863,6 +4872,17 @@ int16_t TFT_eSPI::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font)
} }
// End of RLE font rendering // End of RLE font rendering
#endif #endif
#if !defined (LOAD_FONT2) && !defined (LOAD_RLE)
// Stop warnings
flash_address = flash_address;
w = w;
pX = pX;
pY = pY;
line = line;
clip = clip;
#endif
return width * textsize; // x + return width * textsize; // x +
} }