[SDL] Color Key problem w/ 32 bpp
david at hedbor.org
Thu Sep 19 12:45:01 PDT 2002
Charles Wardlaw <kattkieru at yahoo.com> escribió:
> > 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.
GetTextExtentPoint32 is a Windows API call. It gives the exact width and
height of a string in points for an arbitrary string, font face and size.
Doesn't SDL_TTF have a similar function?
More information about the SDL