Hello,
I am trying to get unicode characters working inside of my sfml based program written in C++. I have tried using a wide string but when it draws on screen, it appears as a box with a question mark inside of it. I am using the Consolas font when drawing the text. I have my console set to use the same font and it draws the characters fine, but can't when drawn on screen.
Here is a simplified version of the code I am running:
// Creating of the render window
sf::RenderWindow gameWindow(sf::VideoMode(1920, 1080), "Game", sf::Style::Fullscreen);
// gameWindow is passed over to a thread so now I have a reference via pointer
// Load the font
sf::Font basicFont;
if (!basicFont.loadFromFile("Fonts/consola.ttf")) {
wcerr << L"Can't load text" << endl;
return;
}
// Create the basic text
sf::Text test;
test.setFont(basicFont);
test.setString(L"君の魂");
test.setPosition(500.f,500.f);
test.setCharacterSize(40);
test.setFillColor(sf::Color::White);
gameWindow->draw(test);
The font is loaded successfully and that return statement never called.
I have also attached the consola.ttf since maybe there is a problem with that.
I'm not sure exactly why it is unable to draw those characters.