[SDL] Truetype vs bitmapped fonts? Opinions?

Kovacs kovacs at mt.lv
Tue Apr 11 06:18:14 PDT 2000


Yes, this sounds the most reasonable solution. But how can i use per-pixel
alpha transparency (i'm using 16bpp)? There was one message about it, but
i could not clearly understand.

	Kovacs

On 10 Apr 2000 vining at pacificcoast.net wrote:

> 
> >   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 
> worlds.
> 
> Nichol
> 




More information about the SDL mailing list