nopnop2002/esp-idf-ili9340

Cant display ascii>127

samsam4 opened this issue · 6 comments

Tried with couple fonts incl. provided with your exampe Gothic and the last ASCII char that could be displayed is 127 (some tall rectangle in your Gothic font) next characters with ascii > 127 are not displayed?

	strcpy((char *)ascii, "127: \x7f\x81\xa1\xa2\xa6\xa7");  // only symbol for 0x7f (127) displayed (rectangle)
	lcdDrawString(&dev, fx16G, xpos, ypos, ascii, color);

I added LcdDrowCode function.

Font file that From 0x00 to 0x7f, the characters image of Standard ASCII are stored.
M5Statck-Font-1

Font file that From 0x80 to 0xff, the characters image of Japanese are stored.
It can be seen that no font pattern is stored from 0x80 to 0xa0.
M5Statck-Font-2

Font file that From 0x80 to 0xff, the characters image of Latin are stored.
M5Statck-Font-3

Thank you for quick reaction! I cant test it right away as I have only ESP-IDF 4,2,1 installed and when I tried on 4th August what was the master version from git and was not working with 4,2,1, so I am actually using some older your version that I downloaded in May I think and it was working well (except ascii >127). So will either try to update ESP-IDF (but there was some reason I didn't update it before, just cant remember right now what was ) or will try to patch your old code with whatever you added today.
Best regards

This is mine.

ESP-IDF version:v4.4-dev-2825-gb63ec47238

Ok - I didn't use all your new code (because don't want to install yet 4.4), but found easy fix: just removing/comment out if(ascii < 0x80){ line 211 in fontx.c which I see you also did in some of the recent versions, but in the one that I downloaded in May 2021 was still there. I might don't need yet your new function LcdDrawCode, because lcdDrawString(..); works fine if special and locale symbols are entered as \x7f\x81\xa1\xa2\xa6\xa7 etc. Doesn't work if typed from keyboard or with Alt+code, but I dont need it now and I guess that is why you've made LcdDrawCode?

One more question about font files: When I am using the fontxedit.exe to make my font or even if I just only "Save as" some of the provided your fonts and the fontxedit.exe puts only spaces (0x20) in the place in the font file header where suppose to be font name - 8 bytes from offset 6 to 13. How did you make your font files with names in place - is there any trick with fontxedit or use some other editor to put the names there?
Because without names my code still works, but on terminal output I see plenty of "Fontx: not found."
Thank you and best regards.

just removing/comment out if(ascii < 0x80){ line 211 in fontx.c

Good!!

Doesn't work if typed from keyboard or with Alt+code, but I dont need it now and I guess that is why you've made LcdDrawCode?

I wanted to use the LcdDrawCode function to show where the pattern resides in the font file.

How did you make your font files with names in place - is there any trick with fontxedit or use some other editor to put the names there?

fontxedit.exe sets a space(0x20) in the font name of the FONTX file header.

I searched for the header editor for the FONTX file but couldn't find it.

A Binary editor is required to edit the font name of the FONTX file header.


You need to be aware of this when you add new font files to your project.
https://github.com/nopnop2002/esp-idf-ili9340/blob/master/main/main.c#L1278

Thanks