[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2.3 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 file containing multiple font faces. 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
}

See Also:
3.2.4 TTF_OpenFontIndexRW, 3.2.1 TTF_OpenFont, 3.2.5 TTF_CloseFont



This document was generated on November, 13 2009 using texi2html