Working with Unicode fonts

Hi there
I should render Farsi fonts in an application.I haven’t worked with Unicode fonts before. How to render such fonts with OpenGL?Are there any articles to discuss about the unicode fonts in OpenGL? Are there any useful codes that render the Unicode fonts with OpenGL?

Are there any articles to discuss about the unicode fonts in OpenGL?

No, but it shouldn’t be all that different from any tutorial on using FreeType to render fonts. FreeType worked in Unicode Points. Unfortunately, most font rendering tutorials are not written to be fully useful demonstrations, so they tend to do silly things like put each character in display lists and render a string by assuming each character represents a display list name for that character.

Basically, what you need is the code to use FreeType and extract images into textures. After that, the rendering you’ll have to deal with using your Unicode-aware string interpretation classes.

OK, but how?

Try QuesoGLC: http://quesoglc.sourceforge.net/

OK, but how?

How what? How to use FreeType to extract images from a font file? That’s a Google search away.

How to use a Unicode-aware string?

First, read up on Unicode and Unicode encodings, so that we know what we’re talking about.

Ultimately, any font rendering is going to need to convert the array of some Unicode encoding into an array of Unicode points, because the font only holds the mapping from Unicode points to font glyphs. How you do that is up to you; there are any number of libraries for handling Unicode strings. Probably the least intrusive one is utf-8 cpp; that’s what I use at any rate.

So, once you can extract an image for a particular Unicode point from FreeType, and you can turn your input string into an array of Unicode points, all you need to do is render that image. Normal usage would be to do the extraction process ahead of time, storing the images in a large texture, then pulling out the pieces you need as needed.