freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft] German Letters with FT_Load_Char


From: loki84
Subject: [ft] German Letters with FT_Load_Char
Date: Tue, 31 Mar 2009 16:49:23 +0200

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]