Hi

I have some problems to render UTF8 formated chars with FT_Load_Char.

I use the code from the tutorial (text = std::string):

    for (unsigned int n = 0; n < text.length (); n++)
    {
        /* load glyph image into the slot (erase previous one) */
        err = FT_Load_Char (face, text[n], FT_LOAD_RENDER);
        if (err)
        {
            continue; /* ignore errors */
        }

   ...

If i now try to render some German letters (öäü ÖÄÜ ß  ....) i only get some
rectangles ( [] ).
To prevent this i currently use a dirty workaround

for (unsigned int n = 0; n < text.length (); n++)
    {
        // convert from UTF8 to ISO 8859-1
        if ((unsigned char) text[n] > 127)
        {
            if ((unsigned char) text[n] == 0xC2)
            {
                n++;
            }
            if ((unsigned char) text[n] == 0xC3)
            {
                n++;
                text[n] += 0x40;
            }
        }

        /* load glyph image into the slot (erase previous one) */
        err = FT_Load_Char (face, (unsigned char) text[n], FT_LOAD_RENDER);
        if (err)
        {
            continue; /* ignore errors */
        }

Is it possible to render UTF8 encoded chars directly?
Have anyone some code snips or a link or only the right google search string
^^ for me (i really don't find anything helpfully out there)?

Loki
_______________________________________________
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype

Reply via email to