2023-11-07 02:17 AM
I would like to ask for advice on how to modify text wildcards generated by pure code that cannot be displayed in Chinese. English is displayed normally.
My personal feeling is that the font does not support Chinese, but I don't know where to set it in pure code
Solved! Go to Solution.
2023-11-08 07:36 PM
Thank u for your advice. It works. However, I plan to implement a combination display of Chinese and dynamic numbers in a TextAreaWithOneWildcard , like“第%d组”,But it seems that there is no such function, and I can only continuously convert values to adapt to the sprint function in C language, but it still shows failure
2023-11-07 03:02 AM - edited 2023-11-07 03:03 AM
Hello @Jix ,
You'll necessarily need a font that supports Chinese characters like this one for example. Then in your Typography menu, you have to include the wildcard range like such: 0x4E00-0x9FFF
Also, you can't use the Chinese letters in your code directly without converting it into Unicode because your C++ code is encoded in UTF-8.
So if you want to make a text by pure code, you have to do something like this :
void Screen1View::fillText()
{
const uint8_t* Mystring = (const uint8_t*)"鉴于对人类家庭所";
Unicode::fromUTF8(Mystring, textArea1Buffer, TEXTAREA1_SIZE);
textArea1.invalidate();
}
Let me know if you succeed in making it.
2023-11-08 07:36 PM
Thank u for your advice. It works. However, I plan to implement a combination display of Chinese and dynamic numbers in a TextAreaWithOneWildcard , like“第%d组”,But it seems that there is no such function, and I can only continuously convert values to adapt to the sprint function in C language, but it still shows failure
2023-11-08 08:02 PM
By converting a char type string to const uint8_ t* and function of Unicode:: from UTF8 (); I succeeded! the red characters in touchgfx design are the result which are corresponding the code sprintf(id_temp,"第%d组",2);
2023-11-13 07:58 AM
You're welcome :)
2023-11-13 08:28 AM - edited 2023-11-13 08:46 AM
Hi,
I use u"" approach:
static constexpr char16_t const * const UnicodeRussian = u"цупыйц";
static constexpr char16_t const * const UnicodeChinese = u"本中 您将";
static constexpr char16_t const * const UnicodeArabic = u"بطضغفحلظت";
Now, all strings are Unicode and can be used with cast:
reinterpret_cast<touchgfx::Unicode::UnicodeChar const *>( UnicodeChinese )
2023-11-13 08:32 AM - edited 2023-11-13 08:35 AM
"you have to include the wildcard range like such: 0x4E00-0x9FFF"
This is very helpful, thanks @Osman SOYKURT . I do not think I saw it mentioned anywhere in GFX documentation.
Ferro
2023-11-14 02:21 AM
Thank you for your help. By the way, do you know how to achieve button shake cancellation in touchgfx ? When I operate buttons on the LCD touch screen, I often experience repeated triggering situations . Obviously, a simple delay function does not work. And for ordinary buttons, it seems that there is no function to detect bouncing, but rather abstractbutton classes have this function.
2023-11-21 03:11 AM
Hello @Jix ,
I don't understand what you mean by button shake cancelation. Could you give an example?
2023-11-21 03:19 AM
Such as a toggle button , usually, I flip once with just one click, but it doesn't seem to detect any bouncing functions - only the abstract button seems to be able to monitor bouncing. However, in practical operation, when I press a button on the touch screen and keep my hand pressed, the button will continue to be repeatedly clicked