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

Author Topic: Russian text in sfText  (Read 11426 times)

0 Members and 2 Guests are viewing this topic.

Timofeyka

  • Newbie
  • *
  • Posts: 2
    • View Profile
Russian text in sfText
« on: November 14, 2021, 01:26:08 pm »
Hello! :)

I am creating a game using C SFML (task), but I do not understand how to display Russian text in sfText.

I tried to change the encoding - nothing changes.  >:(
The font fully supports everything.

Question - how do I display the Russian language correctly in sfText?
Thank you in advance!
(by default, I have UTF-8 encoding set, but I tried to use ASCII and others)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Russian text in sfText
« Reply #1 on: November 15, 2021, 04:07:57 pm »
You'll need to (somehow) construct an array of sfUint32's which you then can pass to the sfText_setUnicodeString function. Handling unicode strings in C seems even more annoying that in C++.
If you have C11, then you might be able to make use of <uchar.h> and convert to sfUint32* somehow, see also: https://stackoverflow.com/a/527307/1034248
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Timofeyka

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Russian text in sfText
« Reply #2 on: November 19, 2021, 09:09:47 pm »
Thanks, it works! But there is one but.

I didn't check if this is the case with the usual setString in CFML, but when I use set Unicode String for my counter, not normal text begin to appear.

 

anything