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

Author Topic: Accessing Unicode Codepoints  (Read 3012 times)

0 Members and 1 Guest are viewing this topic.

MadMartin

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Accessing Unicode Codepoints
« on: July 17, 2008, 10:52:56 am »
Hi there,

today I decided to fiddle around with Unicode and to try out if I'm able to bring some cyrillic oder japanese glyphs on the screen.

Tried the following:
Code: [Select]

sf::String UnicodeString;
std::wstring sfmlrocks(L"SFML ROCKS with \u0426!"); // the u0426 should be the cyrillic letter Tse...
UnicodeString.SetText(sfmlrocks);

The font I used with "UnicodeString" knows this letter Tse, proofed in the Windows app "charmap.exe". But when I draw the string, nothing appears, only an additional space before the "!". Has anyone got some hints what to do now?


greets
Martin

PS:
It's a VS2005-Project with Unicode enabled...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Accessing Unicode Codepoints
« Reply #1 on: July 17, 2008, 11:17:16 am »
You need to pass it in the font's character set (3rd parameter of sf::Font::LoadFromFile). The default charset is only made of printable ISO-8859-1 characters.

By the way, while this should work fine, I'm currently rewriting and improving unicode handling so if you see some "bad" code or design don't worry, everything will be clean and 100% working soon.
Laurent Gomila - SFML developer

MadMartin

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Accessing Unicode Codepoints
« Reply #2 on: July 17, 2008, 11:30:00 am »
Ah, for sure, that's what I missed. Thanks for the hint.
I'm looking forward to see your improvements on the unicode topic :wink:

 

anything