R
R
romanbelfer2015-04-03 15:05:20
OpenGL
romanbelfer, 2015-04-03 15:05:20

C# sharpGL text rendering how to output cyrillic?

I convert the text for adequate display. Everything looks good except for the letter "I". The letter has number 255 in the ASKI code table. What could be the problem? How to display it in SharpGL?

private string ConvertText(string str)
        {
            string result = "";

            byte[] asci = Encoding.Default.GetBytes(str);

            foreach (byte c in asci)
                result += Convert.ToChar(c+1).ToString();

            return result;
        }

.......

gl.DrawText(x, y, r, g, b, "Arial", 20, ConvertText(s));

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2015-04-03
@Nipheris

maybe when the code of the letter "i" is in c, it turns into zero in the c + 1 operation? You would first explain the purpose of this conversion (+1 to all bytes).

R
romanbelfer, 2015-04-03
@romanbelfer

This is a problem with remapping in sharpGL itself. When different transformations are performed in the project, then a shift occurs - when I enter the text "vbg" after the conversion becomes "abc" - this is why I have to increment so that the output is adequate. But in any case - all characters are displayed - only not the letter "I".
Without transformations, such a code is working - but the letter "ya" is still not displayed.

private string ConvertText(string str)
        {
            string result = "";

            byte[] asci = Encoding.Default.GetBytes(str);

            foreach (byte c in asci)
                result += Convert.ToChar(c).ToString();

            return result;
        }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question