Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

For a cross platform solution, check out Pango.

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top