#11 Buffer Font does not work with non-ASCII chars


If the Buffer Font mode is used, non-ASCII chars (>=128) if passed as UTF8 are not displayed correctly.
The image attached to this report shows the demo application (FTGLDemo, compiled with MSVC++). The other modes work correct, just Buffer font shows the wrong glyphs. Same applies to Japanese char codes or e.g. German umlauts.

This bug is caused by the "inCache" check in FTBufferFontImpl::RenderI (FTBufferFont.cpp):

if(stringCache[i] && !StringCompare(stringCache[i], string, len))

does not work with UTF8. StringCompare just checks the first char of a multi-byte char and so chars are recognized to be cached, that just share the first byte with a cached char.

In FTFont.cpp FTFontImpl::RenderI() a FTUnicodeStringItr was used to solve a similar problem. So maybe you want to use it for Buffer Font, too.


  • Tobias Gunkel

    Tobias Gunkel - 2008-09-23

    FTGLDemo with Buffer Font and non-ASCII chars (cyrillic)

  • Nobody/Anonymous

    Visual Studio is notorious for mixing UTF-8 and UTF-16 characters, which confuses the FTUnicodeStringItr& operator++() into thinking it's working with UTF-8, but in reality it's UTF-16. To test if this is your problem, comment out the UTF-8 code path and force it run the UTF-16 codepath. If it works, well, you know the root cause of your problem.

  • Sam Hocevar

    Sam Hocevar - 2010-05-23
    • assigned_to: nobody --> sammy
  • Sam Hocevar

    Sam Hocevar - 2010-05-23
    • status: open --> open-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks