OF 0.8.2 has added support for unicode characters, some of you may ask how to print them. Since most of the C++ libraries rarely bother to support wide strings or wide characters, you should convert integer key of keyPressed() event to std::string. Here’s how you can do that, you’ll need Boost.Locale header only library:
#include <boost/locale.hpp>
void ofApp::keyPressed(ofKeyEventArgs& key)
{
u32string ustr; ustr = (char32_t)key.key;
string uchar = boost::locale::conv::utf_to_utf<char>(ustr);
bool isCharPressed = (key.keycode >= 32 && key.keycode <= 96) ||
(key.keycode >= 320 && key.keycode <= 334);
if (isCharPressed) cout << uchar << endl;
}
Here’s a little app demonstrating unicode (English, Russian and Katakana) characters drawing with ofxTrueTypeFontUC addon:
https://github.com/procedural/example-ofUnicode