TrueType font rendering
The TT font structure
typedef struct{
...
} sge_TTFont;
When working with TTF functions you must give a pointer to the font structure. To open a new font (structure) use sge_TTF_OpenFont() and when finished use sge_TTF_CloseFont().
int sge_TTF_Init(void)
Starts the FreeType engine, must be called before any of the other TTF functions. Returns 0 on success.
sge_TTFont *sge_TTF_OpenFont(char *file, int ptsize)
Opens the given ttf file and sets the font size to ptsize. Returns a pointer to the new font.
void sge_TTF_CloseFont(sge_TTFont *font)
Removes font from memory.
int sge_TTF_FontHeight(sge_TTFont *font)
Returns the distance between the fonts baseline and the top of the highest character.
int sge_TTF_SetFontSize(sge_TTFont *font, int ptsize)
Change the size of the given font. Returns 0 on success.
SDL_Rect sge_TTF_TextSize(sge_TTFont *Font, char *Text)
Returns the width (.w) and height (.h) of the text with the given font.
int sge_TTF_FontAscent(sge_TTFont *font)
Returns the ascent of the font.
int sge_TTF_FontDescent(sge_TTFont *font)
Returns the descent of the font.
int sge_TTF_FontLineSkip(sge_TTFont *font)
Returns the recommended line skip for this font.
void sge_TTF_AAOn(void)
void sge_TTF_AAOff(void)
void sge_TTF_AA_Alpha(void)
Turns anti-aliasing for truetype output on/off. Defaults to ON. You can also enable alpha blending support (very nice but slow).
void sge_TTF_SetFontStyle(sge_TTFont *font, Uint8 style)
Sets the font style.
Flags: (may be ORed, eg. SGE_TTF_BOLD|SGE_TTF_ITALIC)
SGE_TTF_NORMAL - The default style.
SGE_TTF_BOLD - Bold.
SGE_TTF_ITALIC - Italic.
SGE_TTF_UNDERLINE - Underlined.
Uint8 sge_TTF_GetFontStyle(sge_TTFont *font)
Returns the current font style.
Copyright © 1999-2001 Anders Lindström
Last updated 010218