Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem with sf::Font and cyrillic charset  (Read 8543 times)

0 Members and 1 Guest are viewing this topic.

  • Guest
Problem with sf::Font and cyrillic charset
« on: February 04, 2012, 09:42:32 am »
Hello!
I use SFML 1.6 in my game, and when i draw russian letter, i saw strange ieroglyphs. I found threads on this forum, read it, but this don't help.

Code: [Select]
Font1.LoadFromFile("arial.ttf", 24,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя");

  String ControlString(Unicode::Text("Жми Р.\nPress P for play."),Font1,24);
 


Latin character draw normaly, but russian text stay as ieroglyphs.
And now i don't want use SFML2.0

Sorry my bad English.=)

  • Guest
Re: Problem with sf::Font and cyrillic charset
« Reply #1 on: February 04, 2012, 03:22:19 pm »
On SFML2 i have the same problem, because MinGW has only "C" locale.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with sf::Font and cyrillic charset
« Reply #2 on: February 04, 2012, 06:04:52 pm »
Yes, it's probably an encoding issue. It should work if you provide the UTF-32 values of your characters directly ("\uXXX" with XXX the hexadecimal Unicode codepoint of the character). Maybe a wide string would be enough (L"blahblah").
Laurent Gomila - SFML developer

  • Guest
Problem with sf::Font and cyrillic charset
« Reply #3 on: February 05, 2012, 07:54:57 pm »
Thanks for help!
When i trying to use wstring, compiller return error"Illegal byte sequence". And \u sequence didn't help.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with sf::Font and cyrillic charset
« Reply #4 on: February 05, 2012, 09:03:02 pm »
Quote
When i trying to use wstring, compiller return error"Illegal byte sequence"

Show your code ;)

Quote
And \u sequence didn't help

Show your code ;)
Laurent Gomila - SFML developer

  • Guest
Problem with sf::Font and cyrillic charset
« Reply #5 on: February 05, 2012, 09:13:01 pm »
I set editor encoding to UTF8, and wstring now working.
 
Code: [Select]
Font Font1;
   wstring str=L"абв!";
  Font1.LoadFromFile("arial.ttf", 24,"\u0410\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437"); //some russian character
  String SFstr(str,Font1,24);

  • Guest
Problem with sf::Font and cyrillic charset
« Reply #6 on: February 05, 2012, 09:14:36 pm »
It's working!
Code: [Select]

   Font Font1;
   wstring str=L"Русский текст тут абв!";
  Font1.LoadFromFile("arial.ttf", 24,str);
  String SFstr(str,Font1,24);

Thank you very much!

 

anything