You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue:
A string of a single character is not printed by printToSprite when using a custom font created using the given script
To reproduce:
As far as I could tell, the minimal configuration to see the issue is:
Create a font as a header file ( Arial in this case)
Use it in the code provided (based on "SmoothFont/FlashArray")
Try to print a single character (here a 'C')
Voila ! The C is not printed...
Since the usage of a custom font file is required, I believe it is related to the creation of the font file maybe the characters included...
My changes in the create_font script used with processing:
Size 12
Arial
character range: Basic Latin 0x0021, 0x007E
Code:
To create an example I started from the example "SmoothFont/FlashArray" and changed a few things to simplify it
#include "Arial12.h"
// The font names are arrays references, thus must NOT be in quotes ""
// #define AA_FONT_SMALL NotoSansBold15
#define AA_FONT_SMALL Arial12
#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite spr = TFT_eSprite(&tft); // Sprite class needs to be invoked
void setup(void) {
Serial.begin(250000);
tft.begin();
tft.setRotation(1);
spr.setColorDepth(16); // 16-bit colour needed to show anti-aliased fonts
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// Setup done
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set the font colour and the background colour
tft.setTextDatum(TC_DATUM); // Top Centre datum
int xcenter = tft.width() / 2;
int ycenter = tft.height() / 2;
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// Small font
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
spr.loadFont(AA_FONT_SMALL); // Must load the font first into the sprite class
spr.setTextColor(TFT_YELLOW, TFT_BLACK); // Set the sprite font colour and the background colour
tft.setCursor(xcenter - 100, ycenter-20); // Set the tft cursor position, yes tft position!
spr.printToSprite("Print a single char under"); // Prints to tft cursor position, tft cursor NOT moved
// Single character print to sprite
tft.setCursor(xcenter, ycenter);
spr.printToSprite("C");
// spr.printToSprite("CC");
spr.unloadFont(); // Remove the font from sprite class to recover memory used
delay(4000);
}
void loop() {
delay(8000);
}
The text was updated successfully, but these errors were encountered:
Issue:
A string of a single character is not printed by printToSprite when using a custom font created using the given script
To reproduce:
As far as I could tell, the minimal configuration to see the issue is:
Voila ! The C is not printed...
Since the usage of a custom font file is required, I believe it is related to the creation of the font file maybe the characters included...
My changes in the create_font script used with processing:
0x0021, 0x007E
Code:
To create an example I started from the example "SmoothFont/FlashArray" and changed a few things to simplify it
The text was updated successfully, but these errors were encountered: