[SDL] Compiling SDL

Lion Vollnhals schiggl at web.de
Thu Sep 19 09:59:01 PDT 2002

>    PS: We use python+SDL and pygame. So solutions using them are
> preferable :)

Well, the only real way to do this is manually by calculating how many
characters can fit into a rectangle.  I'll tell you now: skip the TTF
font stuff and use monospace bitmap fonts.  Non-monospace fonts require
a bit more calculation.

Basically, you step through the string character by character and print
away, then add the width of the font to your current X coordinate.  If
you're out of bounds, drop back to the beginning of the line and then
drop down by adding to the y coordinate.  It's a pretty simple thing to
do with a monospace font.  A variable-width font requires you to check
the sizes of individual characters.

Does this help?
- Charles

Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

More information about the SDL mailing list