views:

232

answers:

3

Hello, I'm working on a game (using Ruby) and planning to have it available in several languages. I was wondering what's the best option for rendering text. In particular, whatever I use should be able to render complex fonts (Arabic and Persian in particular).

I've been looking around and have stumbled upon freetype, graphite, and using windows native api functions (I'm fine with it being not cross-platform) to name a few. What should I go with and what are the different trade-offs?

A: 

Check out www.freetype.org It handles non-left-to-right fonts. It generates the glyphs for you, but you must render them to the device (OpenGL/DirectX, etc).

Dan Hewett
+1  A: 

If you're looking for a way to rasterise fonts into bitmaps, both Freetype and the Windows API will handle this nicely.

If you're looking for a way to draw text onscreen, go with Window's native APIs if you can; bidirectional text and accents and all that stuff are quite difficult and time-consuming to get right, so you ideally want an API that handles it for you. Whether or not this is viable for your game depends on what graphics APIs you're using, which you didn't specify.

Edit: To rasterise entire strings of text, you need to use win32's DrawText, which means you need to get your hands slightly dirty.

Is there any API that would simply render a string in the desired language to a bitmap (as it would be rendered to screen) which I simply blit to the screen? I'm using an abstraction API on top of DirectX and I only have drawPixel and drawImage routines.
Firas Assaad
Windows API does it quite easily
Osama ALASSIRY
A: 

For a cross platform solution, check out Pango.

skoob