sdljava.ttf

Class SDLTTF

public class SDLTTF extends Object

SDL_ttf is a TrueType font rendering library that is used with the SDL library, and almost as portable. It depends on freetype2 to handle the TrueType font data. It allows a programmer to use multiple TrueType fonts without having to code a font rendering routine themselves. With the power of outline fonts and antialiasing, high quality text output can be obtained without much effort.

Version: $Id: SDLTTF.java,v 1.11 2005/02/19 02:26:02 ivan_ganza Exp $

Author: Ivan Z. Ganza

Method Summary
static SDLVersiongetTTFVersion()
get a version structure with the compile-time version of the SDL_ttf library.
static voidinit()
Initialize the truetype font API.
static SDLTrueTypeFontopenFont(String path, int ptsize)
Load file for use as a font, at ptsize size.
static SDLTrueTypeFontopenFontIndex(String path, int ptsize, int index)
Load file for use as a font, at ptsize size.
static voidquit()
Shutdown and cleanup the truetype font API.

Method Detail

getTTFVersion

public static SDLVersion getTTFVersion()
get a version structure with the compile-time version of the SDL_ttf library.

Returns: the compile-time version of the SDL_ttf library.

init

public static void init()
Initialize the truetype font API. This must be called before using other functions in this library.

Throws: SDLException if an error occurs

openFont

public static SDLTrueTypeFont openFont(String path, int ptsize)
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.

Parameters: path Path to font file ptsize Point size (based on 72DPI) to load font as. This basically translates to pixel height.

Returns: a TTFFont value

Throws: SDLException if an error occurs

openFontIndex

public static SDLTrueTypeFont openFontIndex(String path, int ptsize, int index)
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.

Parameters: path Path to font file ptsize Point size (based on 72DPI) to load font as. This basically translates to pixel height. index The index to load at

Returns: a TTFFont value

Throws: SDLException if an error occurs

quit

public static void quit()
Shutdown and cleanup the truetype font API. After calling this the SDL_ttf functions should not be used.

Throws: SDLException if an error occurs