Translation TextArea with Wilcard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-21 2:27 AM
I have implemented a TextArea without wildcards to display fixed Chinese content. I have now created a TextArea with wildcards and want to dynamically display any Chinese content in the TextArea buffer. But so far all that has shown is "??? ". How to operate, thank you
Solved! Go to Solution.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-24 1:29 AM
Your range was defined using the actual, rendered glyphs - Try defining the unicode ranges instead . e.g. 0x0-0xe000. I'm unsure if the designer is able to take in ranges like that for anything bug ASCII - And I'm not too familiar with proper chinese unicode ranges.
But let's investigate:
�?? = (U+53C1)
è´° = (U+8CB3)
壹 = (U+58F9)
If i define a range of 0x0-0xe000 my Font_FZYTK_TTF_20_4bpp.cpp is 10MB and it has the following:
// Unicode: [0x58F9, ]
0x00, 0x00, 0x00, 0xFA, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x00, 0x00, 0xC1, 0xCC, 0xCC, 0xFE, 0xCC, 0xCC, 0x6C, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x00, 0x00, 0x00, 0x11, 0x11, 0xFA, 0x11, 0x11, 0x00, 0x20, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x03, 0x70, 0x03, 0x00, 0x00, 0x00, 0x00, 0x66, 0xF2, 0xCE, 0xCC, 0xCC, 0xCC, 0xCC, 0xDF, 0xF2, 0x07, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xF1, 0xC7, 0xCC, 0xCC, 0xCC, 0x8C, 0x47, 0x00, 0x40, 0x01, 0x00, 0x00, 0x56, 0x00, 0x00, 0xF1, 0x7B, 0x77, 0x77, 0xDF, 0x00, 0x00, 0xF1, 0x4A, 0x44, 0x44, 0xDE, 0x00, 0x00, 0xF1, 0x07, 0x00, 0x00, 0xDE, 0x00, 0x00, 0xF1, 0xAD, 0xAA, 0xAA, 0xDF, 0x00, 0x00, 0xE1, 0x18, 0x11, 0x21, 0x9E, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x90, 0x04, 0x00, 0x00, 0x00, 0xC6, 0x00, 0xA3, 0x00, 0x00, 0xC3, 0xCC, 0xEC, 0xCC, 0xDE, 0xCC, 0xCC,
The other two unicodes are present as well.
You've made a slight mistake in your code. The designer already set the buffer for you, so you do not need to do it again. Also, when you simply paste the rendered characters into code i'm not sure this will always go well.
Try using unicodes instead - This makes your application work for me =)
void Screen1View::setupScreen()
{
Screen1ViewBase::setupScreen();
Unicode::UnicodeChar tmp[5] = { 0x53C1, 0x8CB3, 0x58F9, 0x0};
Unicode::strncpy(textArea1Buffer, tmp, TEXTAREA1_SIZE);
textArea1.resizeToCurrentText();
}
(I added a call to resize to the current text, but you don't need that).
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-23 1:47 AM
99% of these cases you
- Haven't defined a wide enough wildcard range in your text tab so the fontconverter can generate pixel data for the unicodes you need
- Do not have the glyphs available in your font (while having 1. right)
Check your generated/fonts/src folder for Font_*.cpp files to see which unicodes were actually found + generated.
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-24 12:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-24 1:29 AM
Your range was defined using the actual, rendered glyphs - Try defining the unicode ranges instead . e.g. 0x0-0xe000. I'm unsure if the designer is able to take in ranges like that for anything bug ASCII - And I'm not too familiar with proper chinese unicode ranges.
But let's investigate:
�?? = (U+53C1)
è´° = (U+8CB3)
壹 = (U+58F9)
If i define a range of 0x0-0xe000 my Font_FZYTK_TTF_20_4bpp.cpp is 10MB and it has the following:
// Unicode: [0x58F9, ]
0x00, 0x00, 0x00, 0xFA, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x00, 0x00, 0xC1, 0xCC, 0xCC, 0xFE, 0xCC, 0xCC, 0x6C, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x00, 0x00, 0x00, 0x11, 0x11, 0xFA, 0x11, 0x11, 0x00, 0x20, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x03, 0x70, 0x03, 0x00, 0x00, 0x00, 0x00, 0x66, 0xF2, 0xCE, 0xCC, 0xCC, 0xCC, 0xCC, 0xDF, 0xF2, 0x07, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xF1, 0xC7, 0xCC, 0xCC, 0xCC, 0x8C, 0x47, 0x00, 0x40, 0x01, 0x00, 0x00, 0x56, 0x00, 0x00, 0xF1, 0x7B, 0x77, 0x77, 0xDF, 0x00, 0x00, 0xF1, 0x4A, 0x44, 0x44, 0xDE, 0x00, 0x00, 0xF1, 0x07, 0x00, 0x00, 0xDE, 0x00, 0x00, 0xF1, 0xAD, 0xAA, 0xAA, 0xDF, 0x00, 0x00, 0xE1, 0x18, 0x11, 0x21, 0x9E, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x90, 0x04, 0x00, 0x00, 0x00, 0xC6, 0x00, 0xA3, 0x00, 0x00, 0xC3, 0xCC, 0xEC, 0xCC, 0xDE, 0xCC, 0xCC,
The other two unicodes are present as well.
You've made a slight mistake in your code. The designer already set the buffer for you, so you do not need to do it again. Also, when you simply paste the rendered characters into code i'm not sure this will always go well.
Try using unicodes instead - This makes your application work for me =)
void Screen1View::setupScreen()
{
Screen1ViewBase::setupScreen();
Unicode::UnicodeChar tmp[5] = { 0x53C1, 0x8CB3, 0x58F9, 0x0};
Unicode::strncpy(textArea1Buffer, tmp, TEXTAREA1_SIZE);
textArea1.resizeToCurrentText();
}
(I added a call to resize to the current text, but you don't need that).
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-24 1:59 AM
When you simply paste the rendered characters into code I'm not sure this will always go well.
​
Yes, that's the problem.When I used the "壹贰�??" string, the actual contents of the textArea1Buffer were not {0x53C1, 0x8CB3, 0x58F9, 0x0}, but GBK2312 encoded data.
Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%s", "one three ");
The point is, how do I force strings to be unicode in vs2013?:grinning_face_with_sweat:
Thank you very much for your answer. Thank you
​
