SFML community forums
Bindings - other languages => C => Topic started by: Timofeyka 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)
-
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
-
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.
(https://i.ibb.co/Y2pXJFZ/image.png)