• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Replacement for GFX fonts

Q&A Forum › Category: ESP32 › Replacement for GFX fonts
0 Vote Up Vote Down
Allen Mulvey asked 3 years ago

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?

Question Tags: fonts tft
6 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
Steph answered 3 years ago

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:

Font Creator Now Creates Adafruit GFX Fonts

0 Vote Up Vote Down
Allen Mulvey answered 3 years ago

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.

0 Vote Up Vote Down
Allen Mulvey answered 3 years ago

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. Some of My Devices

0 Vote Up Vote Down
Allen Mulvey answered 3 years ago

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.

  1. if( (c>=32) && (c<=126) ){ //If it’s 33-126 then use standard mono 18 font
  2. display.setFont(&FreeMono18pt7b);
  3. } else {
  4. display.setFont(&SymbolMono18pt7b);//Otherwise use special symbol font
  5. if (c>126) { //Remap anything above 126 to be in the range 32 and upwards
  6. c-=(127-32);
  7. }
  8. }
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Ohh. I didn’t know about that.
Unfortunately, I don’t know any other option 😐
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2023 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.