Hi, how to display letters above ID 127 on buttons? Because I was trying to use "BUTTON_SetText" and I received blank button.
Displaying letters above ID 127 on widgets
This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.
-
-
Hello,
Please make sure the used font includes the characters you would like to display.
Best regards,
Adrian -
Hi,
I'm sure, I checked it twice in FontCnv. Debug shows that sign is passed to function, but function returns 1 (I found in user guide that it means error). -
Hello,
Could you please tell me which function returns 1?
Best regards,
Adrian -
Something like this:
C Source Code
- char c ='⅔'; //untypical sign with id 8532
- // now I'm trying to convert it to char * in two ways
- //of course not simultaneously
- //first
- char *pChar = malloc(sizeof(char));
- *pChar = c;
- BUTTON_SetText(button, pChar);
- //second
- char *ptr = malloc(2*sizeof(char));
- ptr[0] = c;
- ptr[1] = '\0';
- BUTTON_SetText(button, ptr);
And nothing, button stays blank. -
Hello,
Please note that this character can be displayed only with UTF-8: "\xe2\x85\x94"
Details on how to use UTF-8 encoding can be found in the chapter "Language Support" in the emWin user manual.
Best regards,
Adrian -
Hi,
I'm not entirely sure if only, because function run this way BUTTON_SetText(button, "⅔"); gives the proper result.
But to optimization I would want have array of signs in different type, than char * (I would want to avoid to many '\0'). -
Hello,
⅔ is a multibyte character. It can not be stored in a variable of type char, because char can take 1 byte, only. If using a string "⅔" works, this proofs your compiler is able to handle this character. Therefor in your case it is not required to access the character via UTF-8 key code. Nevertheless it can not be treated like a single byte character.
Best regards,
Adrian
-
Share
- Facebook 0
- Twitter 0
- Google Plus 0
- Reddit 0