Small font for adafruit-gfx-graphics-library

Hello Does someone have a link for a small font for adafruit-gfx-graphics-library

https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts

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.

David.

Thx David I will give it a try.

I Tried this that does not work

void printButtonText2(){
float f;
int percentage;
tft.setTextSize(2);
ui.setTextAlignment(CENTER);
ui.setTextColor(ILI9341_ORANGE, ILI9341_BLUE);

tft.setTextSize(5);
tft.setFont(NULL);
ui.drawString(30, 200, “Das ist ein Test”);

tft.setTextSize(2);

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.setFont(NULL);
ui.drawString(MainBUTTON_X + 45, MainBUTTON_Y * i + 35, Buffer);
percentage = i+1103;
ui.drawProgressBar(10, 220, 320 - 20, 20, percentage, ILI9341_WHITE, ILI9341_RED);
delay(50);

My screen is still blank except for the Progress Bar

It would help if you said which library(s) you are using. And pasted/attached some minimal sketch.

Start with a "Hello World" using different Fonts.

David.

You are right David

include "SPI.h"

include "Adafruit_GFX.h"

include "Adafruit_ILI9341.h"

include "GfxUi.h"

I use for my Due board the Ili9341

ILI9341_due Lib

that is a really great Lib, with all the good features

Thx to Adafruit and their libs , but in the moment I don't get it to work properly

This is working

uint32_t testText(int Value) { tft.fillScreen(ILI9341_BLACK); uint32_t start = micros(); tft.setCursor(0, 0); tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1); tft.println(Value); tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2); tft.println(1234.56); tft.setTextColor(ILI9341_RED); tft.setTextSize(3); tft.println(0xDEADBEEF, HEX); tft.println(); tft.setTextColor(ILI9341_GREEN); tft.setTextSize(5); tft.println("Groop"); tft.setTextSize(2); tft.println("I implore thee,"); tft.setTextSize(1); tft.println("my foonting turlingdromes."); tft.println("And hooptiously drangle me"); tft.println("with crinkly bindlewurdles,"); tft.println("Or I will rend thee"); tft.println("in the gobberwarts"); tft.println("with my blurglecruncheon,"); tft.println("see if I don't!"); return micros() - start; }

but I would like to do it the other way Thx for helping

The regular way to select the System font with an Adafruit_GFX library is setFont(NULL)

It looks as if ILI9341_due library provides its own "equivalent" methods instead of inheriting the real Adafruit_GFX class.

So you probably say setFont(SystemFont5x7)

I suggest that you look through the ILI9341_due examples. See how Marek does it.

David.

I did it this way
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)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?

David.

@ats7738

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!

I suspect you are trying to hack this sketch... I guessed this as I have my own hacked version here.