2020-06-06 11:26 AM
I am trying to display a temperature value and would like to include the degree symbol °. I have included this symbol in the typographies as a wildcard character. TouchGFX displays the string, but it inserts the fallback character and then the wildcard character. (72 ?°) Why is the fallback character being inserted?
2020-06-08 02:24 AM
Hi,
If you put the symbol "°" (or any other) in wildcard character, you can display it by displaying an UnicodeChar array. You need to implement the correct ASCII code: in this case, ° = 0x00B0.
With the settings and the code below you will display the following message : The temperature is 28 °.
Watch out: you need have a text area large enough to display the message, so removing auto size and increasing the width could be a good idea (in the Text Area tab on the right side of the Designer tool).
Screen1View::Screen1View() //replace with name of your screen
{
Unicode::UnicodeChar a[] = {0x00B0,0};
uint16_t degree = 28;
Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%d %s", degree, a);
textArea1.invalidate();
}
Otherwise the symbol "°" is already supported :smiling_face_with_smiling_eyes:, you don't have to do the above process . In the the documentation on text and fonts, this section's example tries to display a temperature, and sets the symbol "°" directly in the text section of the Text Area configuration tab.
/Romain
2020-06-17 06:11 AM
It took me a while to figure out how get the degree symbol be placed in the Designer. Maybe I am missing it, but the "this section's example" doesn't give a very good explanation on how to actually get the symbol in the designer. For anyone wanting to do this, hold down the Alt key and type the code 0176--This HAS to be done on the number key pad (with Num Lock on).
2020-06-18 12:49 AM
You are right to point out that solution, I didnt think that people would not have access to the degree symbol on their keyboard (french keyboards have the degree symbol).
You can also just copy/paste the ° symbol from anywhere to designer as well using the ctrl c and ctrl v shortcuts.
Thanks a lot for pointing that out, this is one of those solutions/shortcuts we forgot to explicitly write down, like pressing f5 to directly run the simulator.
2021-12-15 04:46 AM
On a Windows laptop with no numeric keypad or way to simulate it, such as my Dell Precision, the easiest way I found is to bring up the Character Map application, found in the Windows Accessories folder. You can Copy/Paste your symbol directly into Designer from it. No need to mess with Unicode characters in the C code.
From Resources: