In many Projects i use a Simple Workaround to draw Fonts.


1. The Pixels are stored in RGB565 Top left Corner bytewise to Right bottom Corner, continous  next Picture.

2. The Font is stored in Pictures ordered by ASCII Code.

3. We can use the Fonts Startpoint  in Flash, first Point=0 (Different Fonts)

Pseudocode:

uint32_t fontStart=0;     // Font Startpoint
char mychar= '#';         //Char to Draw
uint8_t ascii = (uint8_t)mychar; //get ascii code from char
ascii = ascii - 32;       //SPACE(ascii=32) is our first Picture in Flash, '#'= 36

//we need the fourth Picture Startpoint from Flash

uint32_t charstartpoint = fontStart + (ascii*picwidth*picheight*2) //2 bytes RGB565 Pixeldata / Pixelcolor

 Char Example:

uint8_t *buf = new uint8_t[picwidth*picheight*2];
mem.read(charstartpoint, buf, mywidth*myheight*2 ); //mem.read(startaddress, *buffer, length );
tft.drawDMAImage(buf, posx, posy, picwidth, picheight ); //Adafruit Library 

Simple String  Text Example:

String metertext = "Powermeter";
  for(int i=0; i<mystring.length();i++)
  {
    char mychar= (char)mystring.charAt(i);
    uint8_t ascii = (uint8_t)mychar; //get ascii code from char
    ascii = ascii - 32; 
    uint32_t charstartpoint = fontStart + (ascii*picwidth*picheight*2);
    
    mem.read(charstartpoint, buf, picwidth*picheight*2 ); //mem.read(startaddress, *buffer, length );
    tft.drawImage(buf, x+picwidth*i, posy, picwidth, picheight ); 
    }