I need to display text in my game, who doesn't.

I had originally thought that I could just statically render all the text I would need to images and use those. I'm starting to think that is a bad idea. I figure I'll have to internationalize it in the future, and the game has score counters and such which cannot be statically rendered. It looks like I'll need to use a more dynamic approach.

So my question.

How do games usually handle font loading?

  • Load the TTF directly and render it to a texture atlas.
  • Pre-bake the TTF into an image with a configuration file storing locations and kerning.

4 Answers 4


This is what you're looking for:


Used by numerous games, from indies to AAA titles, to create bitmap fonts from TTFs

Using this tool or something similar is probably the most common way to implement font rendering in a game. Other options do exist (e.g. rendering vector fonts directly with something like FreeType), but the simplicity and performance of bitmap fonts usually makes them the obvious choice

(Note that Valve's distance-field stuff is super-sweet for extreme magnification of text, such as the examples of decals in an FPS, but of little or no benefit for UI text, which is often being scaled down from the source texture, or maybe scaled up just a little)

  • 2
    \$\begingroup\$ I totally disagree. We used Valve's font stuff for our UI, and it was an enormous memory savings compared to caching bitmaps for each character + outlined character + bold character at 3 font sizes, and it makes text scaling in flashy UIs much cheaper / nicer. \$\endgroup\$
    – user744
    Commented Aug 14, 2010 at 10:22

If you are working with something that supports shaders and reasonably large textures, Valve has a technique for font rendering that scales very nicely and has minimal memory cost compared to other methods.


If you need Unicode support, you can split the font textures up by codepage block or whatever. I believe we found that even fairly complicated kanji were readable at small-ish prerendered sizes (128x128 and 64x64).

If you are trying something more complicated, like Arabic, or Devanagari, you are pretty much screwed, no matter the method you choose. There's no way to render arbitrary text in some languages efficiently in real-time, and you'll end up needing to render character digraphs/trigraphs/whole words at once.

  • \$\begingroup\$ Indeed, the moment I found out I had to support Japanese and Korean I switched to static bitmaps for a project. \$\endgroup\$
    – Kaj
    Commented Aug 13, 2010 at 23:10
  • \$\begingroup\$ @Kaj: Japanese and Korean require special IMEs but the rendering is the same as English. Valve's technique works fine, as do more traditional techniques. Where Valve's technique fails is languages with complicated kerning. \$\endgroup\$
    – user744
    Commented Jun 11, 2012 at 18:53

One important question is how many languages you plan to support. If you are going to need to support things like Arabic, you are pretty much stuck with freetype (which speaks TTF) since rewriting Arabic kerning rules is probably up there with writing your own GPU driver in terms of pain.


Distributing the TTF is usually significantly more expensive (money wise) than other licensing schemes, so the games that do that are pretty rare. See also this thread. You don't want to make a Unicode font yourself.

Most implementations I've seen follow something like what you suggested in your second bullet point. A lot of modern AAA games, though, are starting to use Flash to render all their UI elements and I'm not entirely sure how that handles its fonts.

  • 1
    \$\begingroup\$ Flash for the UI! Really? How does that work? \$\endgroup\$
    – deft_code
    Commented Aug 13, 2010 at 17:32
  • 1
    \$\begingroup\$ Look up ScaleForm. That's what a lot of AAA games use. If you need something cheaper look at this thread: gamedev.stackexchange.com/questions/1707/is-gameswf-usable \$\endgroup\$
    – Tetrad
    Commented Aug 13, 2010 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .