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

3.2.1 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
}

See Also:
3.2.3 TTF_OpenFontIndex, 3.2.2 TTF_OpenFontRW, 3.2.5 TTF_CloseFont



This document was generated on January, 14 2006 using texi2html