ofxFontStash
ofxFontStash copied to clipboard
Unicode characters dissapearing
Hey, thanks for the addon! It's great. I've discovered on issue though. I have a sketch when every time I hit a key on the keyboard some predefined text (one character at the time) gets printed on the screen using ie. font.drawMultiLineColumn funtion. It works great for US character set , but when it has to print some non US characters ie. "ężćńą" the first stroke clears the entire line and nothing gets displayed , then the second stroke prints line + the unicode character. It's a bit weird so I've attached the screen.
Typing away ...
Next key stroke - this should type 'ź' but it clears the line instead
Finally after 2nd keystroke the character gets printed
hm are you sure the character input you are getting is right? Can u try loading the non-ascii chars from a file, or hardcoding them in your source code? Otherwise post some of your code and I can have a look
Sorry, same problem here. of0.9.7 + vs2015 + windows 10. I just used the example code and unicode characters won't show up.
Now it works after I change LocaleToUtf8() to a previous version:
string LocaleToUtf8(const string & locale){
int size = MultiByteToWideChar(CP_THREAD_ACP, // code page
MB_ERR_INVALID_CHARS, // character-type options
locale.c_str(), // address of string to map
-1, // NULL terminated
NULL, // address of wide-character buffer
0) + 1; // size of buffer
WCHAR * pWideChar = new WCHAR[size];
MultiByteToWideChar(CP_THREAD_ACP, // code page
MB_ERR_INVALID_CHARS, // character-type options
locale.c_str(), // address of string to map
-1, // NULL terminated
pWideChar, // address of wide-character buffer
size); // size of buffer
size = WideCharToMultiByte(CP_UTF8, // code page
0, // performance and mapping flags
pWideChar, // address of wide-character string
-1, // NULL terminated
NULL, // address of buffer for new string
0, // size of buffer
NULL, // address of default for unmappable characters
NULL) + 1; // address of flag set when default char used
char * pUtf8 = new char[size];
WideCharToMultiByte(CP_UTF8, // code page
0, // address of wide-character string
pWideChar, // address of wide-character string
-1, // NULL terminated
pUtf8, // address of buffer for new string
size, // size of buffer
NULL, // address of default for unmappable characters
NULL); // address of flag set when default char used
string Utf8 = pUtf8;
delete[] pWideChar;
delete[] pUtf8;
return Utf8;
}
Hi, I encountered the same problem. The example works fine. But when I created a new project, and copied and pasted the code in the example, it did not show the unicode characters.
Do I need to do some settings? I did not see any suggested steps in your "readme".
Hi, I encountered the same problem. The example works fine. But when I created a new project, and copied and pasted the code in the example, it did not show the unicode characters.
Do I need to do some settings? I did not see any suggested steps in your "readme".
have you solved the problem yet?
Hi, I encountered the same problem. The example works fine. But when I created a new project, and copied and pasted the code in the example, it did not show the unicode characters.
Do I need to do some settings? I did not see any suggested steps in your "readme".
have you solved the problem yet?
Hi, sorry for lllllllate reply. Can you try another Chinese TTF font? I used a '.ttf' font and it worked perfect. And you have to save the file as Unicode (UTF-8 without signature)-Codepage 65001. Hope this can help you.