Open inrepublica opened 6 years ago
FYI. There is TomThumb in the official repos, so try including that. And before including, make sure to do
#define TOMTHUMB_USE_EXTENDED 1
it will use a bit more space, but give you some more characters, including degree symbol.
I still do not know why there is a vertical line below degree symbol tho.
I have tried to print extended characters from TomThumb font too.
After modifying the TomThumb.h
to change from:
#define TOMTHUMB_USE_EXTENDED 0
to
#define TOMTHUMB_USE_EXTENDED 1
I did not get any character print for extended values. Does anyone have the same issue?
See the picture of the following code:
display.setFont(&TomThumb);
display.setTextWrap(true);
for(int i = 32; i < 256; ++i)
{
display.print(i);
display.print(": '");
display.write(i);
display.print("', ");
}
display.display();
I have tried to print extended characters from TomThumb font too. After modifying the
TomThumb.h
to change from:#define TOMTHUMB_USE_EXTENDED 0
to
#define TOMTHUMB_USE_EXTENDED 1
I did not get any character print for extended values. Does anyone have the same issue?
Try also changing last line of TomThumb.h file from 0x7F to 0xFF (or higher, i.e. 0xFFFD, if you need even more extended fonts from this set. I am not sure how they look up in this table, but I am assuming using binary search).
https://github.com/adafruit/Adafruit-GFX-Library/blob/master/Fonts/TomThumb.h#L474
This is an old thread but as the situation is still the same, I'll add some remarks:
Here is a snippet I use to fix it:
// the TomThumb font is shipped with Adafruit GFX, and is the only official font that has extended characters
// but it's somewhat quirky: it misses chars from 0x7E to 0xA1.
// It also has a dozen extra chars above 0xff that I didn't bother to add except for the Euro symbol
if (applyTomThumbShift) {
out = (unsigned char *)output;
while (*out) {
if (*out > 0xA0U)
if (*out == 0xA4U)
*out = 0xEAU; // add Euro char €
else
*out -= 0x22U; // shift the codepoint to make up for the gap
else if (*out > 0x7EU)
*out = 0x20U; // missing characters. Convert to space.
out++;
}
}
Also, as mentioned, on top of the TOMTHUMB_USE_EXTENDED flag, you have to modify the last line of TomThumb.h :
const GFXfont TomThumb PROGMEM = {(uint8_t )TomThumbBitmaps, (GFXglyph )TomThumbGlyphs, 0x20, 0xEA, 6};
HIH.
I'm trying to use TomThumb with my little project. I use a wemos d1 mini pro (ESP8266) and the wemos OLED shield (64*48 SSD1306). Here is my project -> my project
When i use the default font no problem degree symbol is used:
But when i use the tomthumb font, nothing is displayed:
Sorry for my bad english ;-(