adafruit / Adafruit-GFX-Library

Adafruit GFX graphics core Arduino library, this is the 'core' class that all our other graphics libraries derive from

Home Page:https://learn.adafruit.com/adafruit-gfx-graphics-library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fontconvert upgrades

ftlpilot opened this issue · comments

Can I put in a request to include the degree character 0xB0 (176 dec) glyph when fontconvert converts a TTF file.

Also, is it possible to fix the main algorithm, so odd dots don't sometimes appear at the edges of large fonts.

Can you run fontconvert yourself with a range that includes the 0xB0 code point?

The problem is that the GFXfont struct has no way to represent a noncontiguous range of code points, and takes the reasonable default of only encoding the ASCII printable characters for the built-in fonts, but you aren't constrained to that range as a user of the library. You can generate and use your own GFXfont.

PS: What odd dots? I have been working with GFXfont a lot and haven't noticed this problem.
I have a visualizer I use to check the generated fonts, and it produces reasonable output as far as I can tell. Example: https://gist.github.com/BillyDonahue/fb9cc1fa11bb3a790e37036985d00203

The problem is that the GFXfont struct has no way to represent a noncontiguous range of code points

This can be changed, for examples, like this: https://github.com/virxkane/nucleo-f446re-st7735spi-shield/blob/main/Inc/gfxfont.h
But, unfortunatly, this is out of roadmap.

Happy hacking. If you're more handy with Python than C, I've ported fontconvert to Python. It also includes a gfxfont_preview tool to annotate a font header with C++ comments showing each glyph in ASCII art, which I find really useful for seeing what you're doing.

https://github.com/BillyDonahue/Adafruit-GFX-Library/tree/fontconvert_py

@ftlpilot I was also looking for a way to include the degree character (°) into my font, and ended up hacking fontconvert to allow me to do it. Instead of adding support for multiple ranges (which complicates things not only on fontconvert's side, but also requires changes to the library code that uses the font), I decided to instead include the glyphs I needed in place of characters I did not need.
For more details, see this PR: #395