SDL_ttf
SDL_ttf > Functions > Management
TTF_OpenFont
TTF_Font *TTF_OpenFont(const char *file, int ptsize)
file
- File name to load font from.
ptsize
- Point size (based on 72DPI) to load font as. This basically translates to pixel height.
Load file for use as a font, at ptsize size. This is actually TTF_OpenFontIndex(file, ptsize, 0). This can load TTF and FON files.
Returns: a pointer to the font as a TTF_Font. NULL is returned on errors.
// load font.ttf at size 16 into font
TTF_Font *font;
font=TTF_OpenFont("font.ttf", 16);
if(!font) {
printf("TTF_OpenFont: %s\n", TTF_GetError());
// handle error
}
