`Enhancement` Broken Thai language displayed on NSPanel.
Closed this issue · 13 comments
Enhancement Summary
Broken Thai language displayed on NSPanel.
Detailed Description
Currently, Thai characters are displayable since it's also included in full charset list. However, it's not being displayed in a correct way. I believe it's due to the letter combination we have in our language and it's much like Korean where we mix the character up for words with upper and lower letter for vowels and intonations.
Based on the hmi/dev/ui/fonts/CJK/Full Charset.txt, we currently have
"กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำ฿เแโใไๅๆ๏๐๑๒๓๔๕๖๗๘๙",
which covers all of the Thai letters, vowels, intonation marks and numbers. However, when we write word in Thai, we combine these characters in a weird way and not just by ordering the letter from front to back to form a word. This is why the word appear on the display in a weird way when it has an upper or lower letter. For example, "ข ำ"
is displayed instead of "ขำ"
, which is the correct way to write the word.
I think the problem could be both an unsupported Thai character font is being used in the project or the the space between the letter is too much that it causes the letter break.
I tried to look for the font_id or anything that I can use to tweak in the yaml of ESPhome in order to change to Thai supported Google font but I can't seem to find that in both substitutions:
area or anywhere in the esphome/nspanel_esphome_core.yaml. As I'm a newbie in ESPHome, can you please guide me what should I do in order to change the displayed font to the fully supported Thai character from Google Font?
This project is such a great project. Thank you very much for making NSPanel usable for real.
Really looking forward to your reply.
Additional Context
Picture showing how the Thai characters are currently displaying on the NSPanel with the project.
So, the challenge is to add the new chars set without adding another set of TFT files and limiting to the memory available.
Please take a look at this where we discussed about adding CJK so you will understand better the challenges and my come with some ideas:
So, the challenge is to add the new chars set without adding another set of TFT files and limiting to the memory available. Please take a look at this where we discussed about adding CJK so you will understand better the challenges and my come with some ideas:
Thanks. I did a quick test on changing the font with nextion-editor and it seems to be able to display my language correctly now. However, it seems like the characters are being limited somewhere in config file so that most of the words could only be shown half of it. For example, it shows "ห้องรับ" instead of "ห้องรับแขก"
Anyway to possibly modify the range of the word to more characters in order to have the word displays correctly on the panel?
Thank you and looking forward to hearing from you.
Each text field on Nextion have its own limit of length, and this is counted in bytes, so you probably are reaching this limits as the Thai chars might take 2 or 3 bytes each.
We can increase the size of those fields, but will probably reach some memory limitation on Nextion. We also have to make some adjustments on ESPHome side if we will have 3 bytes chars.
Try to play with the max length on some fields and let us know if that helps with this issue you are facing.
Expanding Max Length helps but I got that weird problem just like in the Chinese Language issue where the character in the middle of the word not showing up. For example, it should show 'ห้องรับแขก' but instead it comes up as ' ห้อรับแขก' (Please pay attention to the missing 'ง')
I'm trying to search for the solution in the that thread but it seems like I couldn't really find it. Is it because Thai is a 3 bytes so it causes the missing of the letter in the middle of the word?
Apart from that, I'm now playing with the max length to find the right length that would not make the tft file becomes too large and will also be enough to cover all the word in Thailand that could be used as the entity names or values.
I believe this is related to that char missing in the font. Have you tried only that char alone in a field? Can it even be shown?
I tried only the 'ง' char in the field alone and it could display correctly as ง on the panel. However, when I tried 'ห้อง', it only show 'ห้อ' without 'ง' again.
I also tried changing the font to different Thai font (which is a standard Thai font) and the problem is still persisted. I know we can specify only the words we want to generate when we generate the font like our Chinese Friends but that would mean it would never be able to fully displayed Thai correctly since our language is more of the combination of the letter than the drawing like Chinese.
Can you send here the full list of chars used in Thai?
Here is the full list of chars used in Thai.
Alphabets:
กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮ
Vowels:
ะ
า (This has shorter line)
ั
ำ
ิ
ี
ุ
ู
ึ
ื
฿
เ
แ
โ
ใ
ไ
ๅ (This has longer line, not the same as above.)
Intonations:
่
้
๊
๋
Others:
ๆ๏๚๛ฯ
Numbers:
๐๑๒๓๔๕๖๗๘๙
For vowels and intonations, I have to separate the letter line by line so that it's not messing up.
Hope this helps.
Thank you in advance.
What I have done so far and doesn't work.
- Changing to another font.
- Adding the words that display incorrectly like 'ห้อง' to the specified characters when generating the font.
- Since this doesn't seem to happen with panel_name, I also tried changing the font sta option of button_text to 'solid color' from 'crop_image' to see if it works. As expected, it doesn't work. But since it's the only thing in the config between panel_name and button_text that is different, I couldn't have but had to try.
By providing the Thai charset, I really hope you might be able to find the solution to this.
Please let me know if I can be any help on this issue.
Something weird happened this morning.
After I switched to dev
branch and re-flashed back to main
later using the exact same TFT that caused the problem mentioned above, it seems like the problem just solved automatically. The missing ง
comes back and displayed correctly as ห้อง
on the display.
I will test a bit more and if the problem really is settled, I will report back and close the issue.
I think it works now. Tested with all the word combinations in my use case and it works as expected.
I'm closing this issue now. Thank you very much.
What about the field sides? Are those all good now?
The field size of the translation in dev
branch is still too small for Thai language, hence it's not displaying all the characters of the word. For that, I will switch back to dev and test again along with the ESPHome logs on why the panel is not opening any pages other than the home page. I will update that issue on #2331
Regarding this one, apart from changing the font, I had to increase the max length of the button_text to 100 in order to make the common words display the whole entity names.