Hello
Does someone have a link for a small font for adafruit-gfx-graphics-library
The smallest font in the font folder seems to be a 9px.
I don't use Linux so I can't install the suggested tool .
I'm looking for a font with the size of
tft.setTextSize(1);
matches.
Why I don't do it this way because than the screen is empty
I have to do this like this
ui.setTextAlignment(CENTER);
ui.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
tft.setFont(&ArialRoundedMTBold_14); // here need small font
ui.drawString(120, 20, Buffer);
tft.setFont(&ArialRoundedMTBold_36); // here need small font
The regular "system" font is 5x7. It is the default.
You select it with
tft.setFont(NULL); // default 5x7 system font
I think that I have a 3x6 font somewhere. It looks horrible.
I have TomThumb font too.
Personally, I think the Adafruit system font looks pretty good.
There is also SmallFont from UTFT. I have a FreeSmallFont that comes with MCUFRIEND_kbv library.
tft.setTextSize(2);
tft.setTextColor(ILI9341_DARKGREY);
for (int i=0; i<5; i++){
uint32_t start = micros();
uint32_t Color = random(0xffffff);
f = start / 1000;
// dtostrf(f,3,2,sFloating);
sprintf(Buffer, "%d) Ausgabe : %d", i, start);
tft.setCursor (MainBUTTON_X + 15, MainBUTTON_Y * i + 15);
tft.println(Buffer);
percentage = (i+1)102;
Serial.println(percentage);
ui.drawProgressBar(10, 220, 320 - 20, 20, percentage, ILI9341_WHITE, ILI9341_RED);
delay(50);
}
}
Now I have to find a solution so when a new figure comes I have to delete the changing outputs!
Thx David
Please use CODE tags. And press ctrl-T in the IDE. You get nicely indented readable code:
void printButtonText2() {
float f;
int percentage;
tft.setTextSize(4);
tft.setCursor(50, 180);
tft.setTextColor(ILI9341_ORANGE);
tft.println("Spring !");
ui.drawProgressBar(10, 220, 320 - 20, 20, 0 , ILI9341_WHITE, ILI9341_BLUE);
tft.setTextSize(2);
tft.setTextColor(ILI9341_DARKGREY);
for (int i = 0; i < 5; i++) {
uint32_t start = micros();
uint32_t Color = random(0xffffff);
f = start / 1000;
// dtostrf(f,3,2,sFloating);
sprintf(Buffer, "%d) Ausgabe : %d", i, start);
tft.setCursor (MainBUTTON_X + 15, MainBUTTON_Y * i + 15);
tft.println(Buffer);
percentage = (i + 1) * 10 * 2;
Serial.println(percentage);
ui.drawProgressBar(10, 220, 320 - 20, 20, percentage, ILI9341_WHITE, ILI9341_RED);
delay(50);
}
}
I don't see what you do with f or Color. And there is no mention of setFont().
It is worth sitting down with a nice cup of tea. Design a universal helper function that prints a message at X,Y and animates a progress bar.
If you are printing an updated progress "value", you need to draw the background before you print in transparent mode. Look at Marek's library methods. Does he provide an overwrite mode for printing text?
The problem is that you are running a sketch with built in extensions to the Adafruit library via a ui. class. The ui. class only supports a limited set of local fonts. To use the Adafruit stock fonts you need to reference the Adafruit class member functions via tft. and NOT use ui. for them!