[SDL] Truetype vs bitmapped fonts? Opinions?

vining at pacificcoast.net vining at pacificcoast.net
Mon Apr 10 10:50:14 PDT 2000

>   What is the big need for ttf in SDL? I mean if its a game or something
>that needs performance bitmaps fonts should be used.

Bitmap fonts don't scale worth beans. That said, using TTFs each time aren't the right way to go.

Here's the real best way to go, IMO, and an example of how I feel C++ and classes should be used. More on this sort of ranting 
later, as if you haven't heard enough!

Create a CFont object. When it initializes, have it choose a font, and a point size. This font's constructor then renders letters using 
SDL_ttf (or whatever) for each letter in the font that you'll actually end up using (for easy use, always store your font 
characters internally in some sort of useful format, like ASCII characters). Store 'em with alpha values, like Bill suggests, the 
smart fellow that he is. Then, your code for rendering would be called something like:

myFont->printf(0,0,"Mord wuz here\n");

which just goes through and blasts down the bitmaps. Then, if you need another font, allocate another CFont object. Best of both 


More information about the SDL mailing list