The fonts that come with the ILI9341_t3 library are all 7-bit, but all you need for 8-bit printing is an 8-bit font.
The library comes with an "extras" folder, that contain a font converter. It converts ttf fonts to 7bit fonts that works with the ILI9341_t3 library.
All I needed was to change from
#define ENCODING_END 127
to
#define ENCODING_END 255
The converter then produce an 8-bit font, with additional characters in the 128-255 range. I converted DejaVuSerifCondensed-Bold.ttf this way.
My linux pc normally uses utf-8 encoding for files, which is not an 8-bit code. But if I convert a .ino file with 8bit strings to iso8859-1, then it works correctly with the converted font. So I can write char *x="½×½=¼ «æøå»" and get just that with tft.print(x);
An utf8-encoded file can be converted to iso8859-1 like this:
iconv -f UTF-8 -t ISO-8859-1 string-utf8.h > string-iso8859-1.h
Attached an image showing the ILI9341 displaying a 8x16 grid with DejaVu characters in the 128-255 range. The two first rows are empty as the default font encoding don't put any symbols there.
After doing this, I discovered an utf-8 enabled version of the ILI9341_t3 library. It is better than this approach, so my suggestion is to merge that.
The library comes with an "extras" folder, that contain a font converter. It converts ttf fonts to 7bit fonts that works with the ILI9341_t3 library.
All I needed was to change from
#define ENCODING_END 127
to
#define ENCODING_END 255
The converter then produce an 8-bit font, with additional characters in the 128-255 range. I converted DejaVuSerifCondensed-Bold.ttf this way.
My linux pc normally uses utf-8 encoding for files, which is not an 8-bit code. But if I convert a .ino file with 8bit strings to iso8859-1, then it works correctly with the converted font. So I can write char *x="½×½=¼ «æøå»" and get just that with tft.print(x);
An utf8-encoded file can be converted to iso8859-1 like this:
iconv -f UTF-8 -t ISO-8859-1 string-utf8.h > string-iso8859-1.h
Attached an image showing the ILI9341 displaying a 8x16 grid with DejaVu characters in the 128-255 range. The two first rows are empty as the default font encoding don't put any symbols there.
After doing this, I discovered an utf-8 enabled version of the ILI9341_t3 library. It is better than this approach, so my suggestion is to merge that.
Last edited: