[SDL] SDL_ttf: Proposed extension for precreated surfaces

Martin Storsjö martin at martin.st
Wed Dec 8 12:55:11 PST 2004


On Wed, 8 Dec 2004, Benjamin Deutsch wrote:

> One thing though: do/can you handle kerning with this method? SDL_ttf seems 
> to use kerning when rendering strings (and depending on the font, this can be 
> very useful), but does not make this information available externally. Should 
> I rather use freetype directly?

Using TTF_GlyphMetrics, you can retrieve some kind of information which 
can be used for kerning.

You could of course store all the retrieved information about all the 
glyphs, but I used another approach.

My implementation, (which is heavily based on the tutorial at
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=43), creates one 
display list for every character, which draws that glyph and translates 
the correct distance. That makes drawing text as simple as a call to 
glListBase and glCallLists.

But, when I think about it now, I suspect that this isn't really 
necessary, and is only a waste of vram.

// Martin




More information about the SDL mailing list