Adafruit-GFX-Library
Adafruit-GFX-Library copied to clipboard
UTF-8 support
Wanted to display glyphs from font.h files generated from UTF-8 font.ttf files. Found some discussions in #185 suggesting the use of iso-8859-x chars, which IMHO is not a good idea (one needs to find a proper tool to convert UTF-8 .ttf files to iso first, then generate the font.h files, that will be still larger than the ASCII font.h files boundled with the library. Even in that case you might end up not beeing able to display a glyph if your iso-8859-x coded font did contain it. Of course a font.h generated from a UTF-8 .ttf will need more memory, but it's 2019 and newer boards tend to have a right amount of memory).
While looking for a solution i also found #200 from Bodmer who also provided me some help. He forked V1.3.6 and modified it but that version does not compile on my board... and since that version even the code has been reordered here in master branch...
So i ended up comparing Bodmer's modified version with the original master and as result here is my PR that enables UTF-8 with custom made fonts, while not changing anything with the default fonts.
UTF-8 support is turned off by default ensure not breaking anything on boards with few ram, you only have to enable it by adding display.utf8() to the sketch.
Tested with a MAX32630FTHR and 2.13" Flexible Monochrome eInk / ePaper Display. For generating UTF-8 font.h files #185 is also needed
Please test on other board/display combinations and merge ;-)
hiya - this PR looks good, it does need a little doxygening please read https://learn.adafruit.com/the-well-automated-arduino-library/doxygen
Hi @ladyada i never used Doxygen and for me using any unix/linux tools is a challange. If there is anyone who knows how to use Doxygen i am happy if i do not need to touch it :-)
By the way i also ported the whole GFX and EPD libraries to Mbed-os. Am not sure if you are interested and if so where shall i post it?
hiya doxygen runs on mac, windows, linux - anything. its important to have all PR's with doxygen so that there is documentation to help support the code, we won't accept a PR without it. its very easy to doxygen, please check the guide we wrote
@BillyDonahue Thanks for the code review and comments i learn a lot from it though i can not understand everything. I began learning C/C++ just a few months ago. Was just happy to find a working fork and then updated the master branch based on that as meanwhile the code got rearranged. That way it compiled on my board and did not run into issues, so i thought the code was ok.
Please feel free to modify the PR, i think the result will be much better as if i would do that :-)
@BillyDonahue just added you as collaborator to my branch in case you can not change the code directly in this PR.