I would guess that your Adafruit display will use Adafruit drivers and Libraries. Hence expect Adafruit-style class methods()
The original Adafruit TFT drivers would use the Adafruit_GFX.h library for graphics and just scale a single 7x5 "system" font.
Subsequently, a "Adafruit_GFX_AS.h" library has appeared in various hacked versions. This can use multiple Fonts, accessed by number.
Rowboteer has posted a link to a new "Adafruit_GFX.h" library that handles Fonts, Buttons, ... on GitHub
This uses Glyphs for the description. It comes with a program to generate Fonts from TrueType. The Fonts that come with the ZIP render very nicely.
Since there are a lot of TFT libraries that follow the Adafruit style, using the Fonts is very straightforward:
#include <Adafruit_GFX.h> // Core graphics library
#include <MCUFRIEND_kbv.h> // Hardware-specific library
MCUFRIEND_kbv tft;
#include <Fonts/FreeMono9pt7b.h>
#include <Fonts/FreeMono18pt7b.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeSans9pt7b.h>
#include <Fonts/FreeSans18pt7b.h>
#if !defined(__AVR_ATmega328P__)
#include <Fonts/FreeSans12pt7b.h>
#include <Fonts/FreeSans24pt7b.h>
#include <Fonts/FreeSerif9pt7b.h>
#include <Fonts/FreeSerif18pt7b.h>
#include <Fonts/FreeSerifItalic9pt7b.h>
#include <Fonts/FreeSerifItalic18pt7b.h>
#include <Fonts/FreeSerifBold12pt7b.h>
#include <Fonts/FreeSerifBold24pt7b.h>
#endif
#define BLACK 0x0000
#define GREEN 0x07E0
void setup(void)
{
uint16_t ID = tft.readID();
if (ID == 0xD3) ID = 0x9481;
tft.begin(ID);
tft.setRotation(1);
}
void showfont(const GFXfont *f1, const GFXfont *f2, char *name, char *name2)
{
int wid;
tft.fillScreen(BLACK);
tft.setTextColor(GREEN, BLACK);
tft.setFont(NULL);
tft.setTextSize(1);
tft.setCursor(0, 0);
tft.print(name);
tft.setFont(f1);
tft.setTextSize(1);
tft.setCursor(0, 50);
tft.print(name);
tft.setTextSize(2);
tft.setCursor(0, 120);
tft.print(String(name) + " x2");
tft.setFont(f2);
tft.setTextSize(1);
tft.setCursor(0, 239);
tft.print(name2);
delay(2000);
}
#define SHOWFONT(x, y) showfont(&x, &y, #x, #y)
void loop()
{
SHOWFONT(FreeMono9pt7b, FreeMono18pt7b);
SHOWFONT(FreeMonoBold9pt7b, FreeMonoBold18pt7b);
SHOWFONT(FreeSans9pt7b, FreeSans18pt7b);
#if !defined(__AVR_ATmega328P__)
SHOWFONT(FreeSans12pt7b, FreeSans24pt7b);
SHOWFONT(FreeSerifItalic9pt7b, FreeSerifItalic18pt7b);
SHOWFONT(FreeSerifBold12pt7b, FreeSerifBold24pt7b);
#endif
delay(4001);
}
This sketch compares the appearance of scaling a font x2 with the correct size font.
You can save memory by scaling but they do not look as good.
There are several strategies for describing and rendering Fonts.
If the Font is going to be stored in the Uno's Flash memory, you worry more about size and less about speed.
Fonts on a Due or Mega are less critical. Fonts on SD card or SPI Flash chip have no size worries. You can just go for speed.
I would guess that you can simply replace with the "Adafruit_HX8357D.h" library or any Adafruit-style hardware specific library.
David.