GFX fonts do not include extended characters like the degree symbol. I’m getting tired of remapping characters. Is there another font system we can use with tft displays?
Hi.
Take a look at this tutorial: https://learn.adafruit.com/creating-custom-symbol-font-for-adafruit-gfx-library
It explains how to create your symbols for GFX fonts.
I hope this helps.
Regards,
Sara
When using the extended ASCII character table, be careful not to confuse the ASCII 167 (masculine ordinal indicator) with the ASCII 248 (degree symbol), which look very similar (and are not necessarily implemented correctly in different fonts).
Otherwise, have a look at Using Fonts section of Adafruit GFX Graphics Library’s guide.
Look also at this article that explains how to convert a font of your choice that is compatible with the Adafruit library:
Thank you for your responses, Sara, I looked at that a couple of years ago but still did not get extended characters. I’ll look again, much could have happened since then, or I might have done something wrong at the time.
Steph, thank you. I use Font Creator often. When it makes GFX fonts it does not include the extended characters. I usually end up using Font Custonizer (https://github.com/tchapi/Adafruit-GFX-Font-Customiser) to remap the carat or tilda to what I need. Usually I want a degree symbol, 176 or 248.
I just checked the Adafruit Font Convert utility. At the top of the C source file it says, “Currently this only extracts the printable 7-bit ASCII chars of a font.” Here are some of my devices.
I’m starting to think Adafruit GFX cannot handle character values outside the “printable” range of 32 to 176. The link cited by Sara above uses a custom print routine which checks the character value. If the value is above 176 it subtracts 95 and switches to a special remapped font. No actual character value above 176 is ever printed.
- if( (c>=32) && (c<=126) ){ //If it’s 33-126 then use standard mono 18 font
- display.setFont(&FreeMono18pt7b);
- } else {
- display.setFont(&SymbolMono18pt7b);//Otherwise use special symbol font
- if (c>126) { //Remap anything above 126 to be in the range 32 and upwards
- c-=(127-32);
- }
- }