[SDL] *fancy* text with SDL_ttf?

Carsten Burstedde c at burstedde.de
Fri Feb 22 11:20:01 PST 2002


>I'm looking for tips on how to create *fancy* text using SDL_ttf.  What I'm 
>after is text like Macromedia "Fireworks" can generate.  Such effects as:
>
>- Alpha blended drop shadow
>- Alpha blended "glow" around text
>- Textured text characters
>- Variable size/colour outline around each character

OpenGL?
You can load the glyph image into a GL_ALPHA texture and use the GL_REPLACE 
texture function. This is used to add an alpha channel to a simple color, or (with 
multitexturing) to a GL_RGB 'real' texture. Then you can scale/shift/rotate/draw multiple 
times as you like. And enable blending.

>oh...and with all the above nicely anti-aliased too  :)

You get it for free with GL_LINEAR texture filtering.

>Can I use SDL_ttf for this or should I be looking elsewhere...?

This is connected to another thread on this list - creating textures from SDL surfaces. I do 
not know about 2D SDL, so maybe keep watching it...

I don't know SDL_ttf, but if it is a simple wrapper around freetype, you may look at the 
source or use plain freetype - all you need is an area of memory with the glyph grayscale 
image and dimensions a power of 2.

Hope this helps,

Carsten






More information about the SDL mailing list