Scrolling Text with ILI9341 and Adafruit_GFX.h

I found this wonderful topic

and it works great but when I change it to my own Font

tft.setFont(&Comic12pt);

it does not delete the old Text-line anymore.
Any Idea

Have a good one

I figured out something like this it’s not smooth so I have to improve this it pixel wise

#include <Adafruit_GFX.h> // Hardware-specific library
#include <MCUFRIEND_kbv.h>
#include "Comic12pt.c"
MCUFRIEND_kbv tft;


void SetText(uint8_t Zeile, String Text, uint16_t Color);
String GetScrolledText(String S, uint8_t Position);


char Buffer[40];


String OldText;
uint8_t Counter = 0;


void setup()
{
Serial.begin(9600);
tft.reset();
uint16_t identifier = tft.readID();
Serial.print("ID = 0x");
Serial.println(identifier, HEX);
if (identifier == 0xEFEF) identifier = 0x9486;
tft.begin(identifier);


 tft.fillScreen(ILI9341_CYAN);
 tft.fillScreen(ILI9341_NAVY);
 tft.setTextColor(ILI9341_ORANGE, ILI9341_NAVY);
 tft.setFont(&_Comic12pt_);
 tft.setTextWrap(false);


 tft.setRotation(1); // horizontal display
}

void loop()
{
uint16_t Zeit;
String text;
Zeit = millis() / 1000;

sprintf(Buffer, "Daisy is a Bitch  %d    -", Zeit);

text = Buffer;

 if (Counter++ > text.length())
   Counter = 0;

 Serial.print("Counter ");
 Serial.println(Counter);

 SetText(6, OldText, ILI9341_NAVY);
 text = GetScrolledText(text, Counter);
 SetText(6, text, ILI9341_RED);
 OldText = text;

 delay(200);

}



String GetScrolledText(String S, uint8_t Position)
{
String t = "";
   // Construct the string to display for this iteration

   for (uint8_t i = 0; i < S.length(); i++)
     t += S.charAt((Position + i) % S.length());
   Serial.println(t);

   return (t);


}


void SetText(uint8_t Zeile, String Text, uint16_t Color)
{
uint16_t Row = Zeile * 14;
tft.setTextColor(Color, ILI9341_NAVY); // Navy is Background
tft.setCursor(0, Row);
   tft.print(Text);
}