SDL_ttf
SDL_ttf > Functions > Management
TTF_OpenFontIndex
TTF_Font *TTF_OpenFontIndex(const char *file, int ptsize, long index)
file
- File name to load font from.
ptsize
- Point size (based on 72DPI) to load font as. This basically translates to pixel height.
index
- choose a font face from a multiple font face containing file. The first face is always index 0.
Load file, face index, for use as a font, at ptsize size. This is actually TTF_OpenFontIndexRW(SDL_RWFromFile(file), ptsize, index), but checks that the RWops it creates is not NULL. 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, face 0, at size 16 into font
TTF_Font *font;
font=TTF_OpenFontIndex("font.ttf", 16, 0);
if(!font) {
printf("TTF_OpenFontIndex: %s\n", TTF_GetError());
// handle error
}
