Arabic text

Hi,
Has anybody tried to draw arabic text using OGL? It has some features, like the same letter has different symbols wether it is at the beginning or at the end of the word, which makes difficult to use the latin character approach (display lists indexed by ascii values). Any hint/documentation/sample code would be greatly appreciated.

Well, not sure this is GL-related, but I also would like to get some informations about that…

This is going to require UniCode support, isn’t it? Can someone point some unicode programming examples? I tried w/o success.
Thanks!

Originally posted by kcmanuel:
Hi,
Has anybody tried to draw arabic text using OGL? It has some features, like the same letter has different symbols wether it is at the beginning or at the end of the word, which makes difficult to use the latin character approach (display lists indexed by ascii values). Any hint/documentation/sample code would be greatly appreciated.

I have tried Arabic text with the OpenSceneGraph but in theory it should work. I have tested out a range of European and Japanse fonts, but not Arabic…

The OpenSceneGraph use the FreeType library to read a whole range of typetype on other fonts. The glyphs are loaded into images, then standard textured mapped quads to render the final characters. The position change from character to character uses the FreeType data on glyph sizes, so handles kerning etc, and also allows for left to right, right to left, top to bottom positioning.

I’d recommend using FreeType, and texture mapped quads, it works a treat and you can configure it to get anti-aliasing for free :slight_smile:

Source code at openscenegraph.org and freetype.org.

Robert.

Arabic is quite difficult because of both directionality and the way that different glyphs are used based on the sequence of characters.

Qt theoretically handles Arabic text, and GTK/Pango should also work. FreeType by itself does not provide everything that you need, and it seems unlikely that OpenSceneGraph would…

Whatever you’re using (Linux with Qt or GTK, Mac, Windows) it’s probably going to be easiest to let the OS draw the text into a bitmap for you, then upload the bitmap as a texture. You don’t want to try and do the layout yourself

OpenGL is not a typography library; it’s mainly a polygonal 3D geometry rasterization library.

I prefer to draw text to GDI offscreen DIBSections, GDIFlush(), upload as a texture, and then draw the texture to a quad. This is fast, and it gives you all of the TrueType anti-aliased UniCode kerning goodness for free.

Assuming you’re on Windows.