The library rAdafruitGFX is used to draw on TFT screens. It has a default font and does not give a way to change the font for drawing text.
This is what I got when drawing very large characters:
To get this size I had to use size 14 in the "configure text" method...
Erel provided an inline C code to set another font:
This code is for a font named "FreeSans12pt7b.h" . If you install the library Adafruit_GFX with the Arduino IDE you get a lot of font files in a directory "Fonts" and you can copy what you want from there to rAdafruitGFX.
Change the name of the file and in the function accordingly. Replace "tft" with the name of the object you use as the adafruitGFX object and add a line to your code :
I changed the font to FreeSans18pt7b.h and got a much better result with size 4:
Next post - how to create your font.
This is what I got when drawing very large characters:
To get this size I had to use size 14 in the "configure text" method...
Erel provided an inline C code to set another font:
B4X:
#if C
#include "FreeSans12pt7b.h"
void SetFont(B4R::Object* o) {
b4r_main::_tft->GFX->gfx->setFont(&FreeSans12pt7b);
}
#End If
Change the name of the file and in the function accordingly. Replace "tft" with the name of the object you use as the adafruitGFX object and add a line to your code :
B4X:
RunNative("SetFont", Null)
Next post - how to create your font.
Last edited: