1
Graphics / [solved] Issues drawing characters outside ASCII char set
« on: July 18, 2024, 12:40:18 am »
Hello, I am having issues printing non-ASCII characters on Windows.
I have tried the font.hasGlyph() function too, but I am not sure if I am using it correctly
)
It does not exit the program here so the characters should exist in the font file
In the attached image I am using the Arial system font which should have the cyrillic alphabet in it. I have also tried it with three other system fonts and three downloaded fonts with the same results.
//i have also tried wide strings and u8 encoded strings
sf::String str= sf::String("привет");
std::cout << str.toAnsiString() << std::endl; //outputs "привет" to console
sf::Text text_block = sf::Text(str, font, 48);
window.draw(text_block);
sf::String str= sf::String("привет");
std::cout << str.toAnsiString() << std::endl; //outputs "привет" to console
sf::Text text_block = sf::Text(str, font, 48);
window.draw(text_block);
I have tried the font.hasGlyph() function too, but I am not sure if I am using it correctly

It does not exit the program here so the characters should exist in the font file
//cyrillic п character in utf-32 bytecode
sf::Uint32 cyrillic_p = 0x0000043f;
if (!font.hasGlyph(sf::Uint32(cyrillic_p))) {
std::cerr << "font error" << std::endl;
exit(1);
}
sf::Uint32 cyrillic_p = 0x0000043f;
if (!font.hasGlyph(sf::Uint32(cyrillic_p))) {
std::cerr << "font error" << std::endl;
exit(1);
}
In the attached image I am using the Arial system font which should have the cyrillic alphabet in it. I have also tried it with three other system fonts and three downloaded fonts with the same results.