Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fontconvert upgrades #373

Open
ftlpilot opened this issue Nov 22, 2021 · 5 comments
Open

fontconvert upgrades #373

ftlpilot opened this issue Nov 22, 2021 · 5 comments

Comments

@ftlpilot
Copy link

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.

@BillyDonahue
Copy link
Contributor

BillyDonahue commented Nov 23, 2021

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

@virxkane
Copy link

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.

@ftlpilot
Copy link
Author

ftlpilot commented Nov 25, 2021 via email

@BillyDonahue
Copy link
Contributor

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

@nilclass
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants