@@ -990,6 +990,11 @@ void TFT_eSprite::scroll(int16_t dx, int16_t dy)
990
990
** Function name: fillSprite
991
991
** Description: Fill the whole sprite with defined colour
992
992
*************************************************************************************x*/
993
+ void TFT_eSprite::fillScreen (uint32_t color)
994
+ {
995
+ fillSprite (color);
996
+ }
997
+
993
998
void TFT_eSprite::fillSprite (uint32_t color)
994
999
{
995
1000
if (!_created ) return ;
@@ -1433,10 +1438,19 @@ size_t TFT_eSprite::write(uint8_t utf8)
1433
1438
this ->cursor_x = 0 ;
1434
1439
this ->cursor_y += (int16_t )textsize * (uint8_t )pgm_read_byte (&gfxFont->yAdvance );
1435
1440
} else {
1441
+ #ifdef USE_M5_FONT_CREATOR
1442
+ int32_t index = -1 ;
1443
+ index = getUnicodeFontIndex (uniCode);
1444
+ if (index == -1 ) {
1445
+ return 1 ;
1446
+ }
1447
+ uint16_t c2 = index;
1448
+ #else
1436
1449
if (uniCode > pgm_read_word (&gfxFont->last )) return 1 ;
1437
1450
if (uniCode < pgm_read_word (&gfxFont->first )) return 1 ;
1438
1451
1439
1452
uint8_t c2 = uniCode - pgm_read_word (&gfxFont->first );
1453
+ #endif
1440
1454
GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword (&gfxFont->glyph ))[c2]);
1441
1455
uint8_t w = pgm_read_byte (&glyph->width ),
1442
1456
h = pgm_read_byte (&glyph->height );
@@ -1542,16 +1556,24 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
1542
1556
#endif // LOAD_GLCD
1543
1557
1544
1558
#ifdef LOAD_GFXFF
1559
+ #ifdef USE_M5_FONT_CREATOR
1560
+ int32_t index = -1 ;
1561
+ index = getUnicodeFontIndex (c);
1562
+ if (index != -1 )
1563
+ {
1564
+ c = index;
1565
+ #else
1545
1566
// Filter out bad characters not present in font
1546
1567
if ((c >= pgm_read_word (&gfxFont->first )) && (c <= pgm_read_word (&gfxFont->last )))
1547
1568
{
1548
1569
// >>>>>>>>>>>>>>>>>>>>>>>>>>>
1549
1570
1550
1571
c -= pgm_read_word (&gfxFont->first );
1572
+ #endif
1551
1573
GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword (&gfxFont->glyph ))[c]);
1552
1574
uint8_t *bitmap = (uint8_t *)pgm_read_dword (&gfxFont->bitmap );
1553
1575
1554
- uint32_t bo = pgm_read_word (&glyph->bitmapOffset );
1576
+ uint32_t bo = pgm_read_dword (&glyph->bitmapOffset );
1555
1577
uint8_t w = pgm_read_byte (&glyph->width ),
1556
1578
h = pgm_read_byte (&glyph->height );
1557
1579
// xa = pgm_read_byte(&glyph->xAdvance);
@@ -1643,9 +1665,17 @@ int16_t TFT_eSprite::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t fo
1643
1665
}
1644
1666
else
1645
1667
{
1668
+ #ifdef USE_M5_FONT_CREATOR
1669
+ int32_t index = -1 ;
1670
+ index = getUnicodeFontIndex (uniCode);
1671
+ if (index != -1 )
1672
+ {
1673
+ uint16_t c2 = index;
1674
+ #else
1646
1675
if ((uniCode >= pgm_read_word (&gfxFont->first )) && (uniCode <= pgm_read_word (&gfxFont->last ) ))
1647
1676
{
1648
1677
uint16_t c2 = uniCode - pgm_read_word (&gfxFont->first );
1678
+ #endif
1649
1679
GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword (&gfxFont->glyph ))[c2]);
1650
1680
return pgm_read_byte (&glyph->xAdvance ) * textsize;
1651
1681
}
0 commit comments