Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 1 of 1

Thread: Easy printing of 8-bit characters on ILI9341 display

  1. #1
    Junior Member
    Join Date
    Jan 2017

    Easy printing of 8-bit characters on ILI9341 display

    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
    #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.

    Click image for larger version. 

Name:	8bittxt.png 
Views:	9 
Size:	126.5 KB 
ID:	9697

    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 by Hafting; 02-20-2017 at 09:11 PM. Reason: Discovered a better alternative

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts