#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "Bug");
sf::Text text;
sf::Font font;
sf::Event event;
if (!font.loadFromFile("test.ttf"))
return 0;
std::basic_string<sf::Uint32> utf32line;
std::string line = "だきまくら";
sf::Utf8::toUtf32(line.begin(), line.end(), back_inserter(utf32line));
text.setFont(font);
text.setCharacterSize(30);
text.setColor(sf::Color::Red);
text.setString(utf32line);
while (window.isOpen())
{
while (window.pollEvent(event))
if (event.type == sf::Event::Closed)
window.close();
window.clear(sf::Color::White);
window.draw(text);
window.display();
}
}
test.ttf is Freemono from Debian package fonts-freefont-ttf. line variable contains UTF-8 encoded string だきまくら, but code tag somehow breaks it.
And here is some FAQ from irc: Yes, freemono supports kana(see;
http://www.gnu.org/software/freefont/coverage.html ), No wchar_t is not going to work. I see (correct number of) boxes with ? in them.
tl;dr: Should work, doesn't.