tchapi / Adafruit-GFX-Font-Customiser

A little utility to customise pixel fonts for the Adafruit GFX library
https://tchapi.github.io/Adafruit-GFX-Font-Customiser/
MIT License
90 stars 47 forks source link

Option to add/remove glyphs? #1

Closed ppostuma closed 6 years ago

ppostuma commented 6 years ago

Great little program - as fontconvert can produce some very ugly results and needs a lot of cleaning up. I'm wondering if it would be hard to adapt your code to all us to add/remove glyphs?

tchapi commented 6 years ago

Hello @ppostuma Good idea, I could give it a go, that could be helpful. I'm happy to accept a PR though, since I will not have much time to dedicate to that in the coming weeks.

BR

tchapi commented 6 years ago

Ok, so, looking a bit more thoroughly into that, I think it's not really possible. The font format is basically made to encode characters from 0x20 to 0x7e (space to ~), so it doesn't make any sense to remove a character (the array at the end of the file expects a row per character, and no "missing" characters in between). As for adding a character, I don't know how I could add it to this array, for the same reason, it will be discarded if not in the correct range.

Happy to accept a PR if ever you find a solution though :) Best

ppostuma commented 6 years ago

I may give it a shot myself - not my forte - but I believe I've seen longer (256-char) fonts, and the gfxFont Class reference (http://doxygen.db48x.net/mozilla-full/html/d7/d7d/classgfxFont.html) seems to suggest it's possible.

In the mean time, I've created custom versions of various fonts - more recently using this utility (THANK YOU!) where I've subbed characters I wasn't using for ones I needed. Not ideal, but it works.

Will update if I get it figured out (assuming it's possible) ..

tchapi commented 4 years ago

@SmallRoomLabs has made a PR that goes in this direction, allowing for a range to be exported. This has been merged in master in case you still need this (2 years later) 🙂