sdljava.ttf
Class SDLTTF

java.lang.Object
  extended by sdljava.ttf.SDLTTF

public class SDLTTF
extends java.lang.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

Constructor Summary
SDLTTF()
           
 
Method Summary
static SDLVersion getTTFVersion()
          get a version structure with the compile-time version of the SDL_ttf library.
static void init()
          Initialize the truetype font API.
static SDLTrueTypeFont openFont(java.lang.String path, int ptsize)
          Load file for use as a font, at ptsize size.
static SDLTrueTypeFont openFontIndex(java.lang.String path, int ptsize, int index)
          Load file for use as a font, at ptsize size.
static void quit()
          Shutdown and cleanup the truetype font API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SDLTTF

public SDLTTF()
Method Detail

init

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

Throws:
SDLException - if an error occurs

quit

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

Throws:
SDLException - if an error occurs

openFont

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

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.