|
|||||||||
| Home >> All >> org >> libsdl >> font >> [ ttf overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.libsdl.font.ttf
Class TTFFont

java.lang.Objectorg.libsdl.SDLStruct
org.libsdl.font.ttf.TTFFont
- public class TTFFont
- extends org.libsdl.SDLStruct
The TTFFont class represents a loaded TrueType
font. This class requires the SDL_ttf library to be loaded.
If the SDL_ttf library is not loaded, an exception of
type SDLLibraryNotAvailableException is thrown when
attempting to instantiate the object.
------ EXAMPLE ------
String fontPath = ...
int fontPtSize = ...
SDL sdl = SDL.getInstance();
sdl.init(SDL.SDL_INIT_VIDEO);
try {
TTFFont font = new TTFFont(fontPath, fontPtSize);
font.getHeight(); // etc...
} catch (SDLLibraryNotAvailableException libe) {
...
}
- Version:
- $revision$
| Field Summary | |
static int |
TTF_STYLE_BOLD
|
static int |
TTF_STYLE_ITALIC
|
static int |
TTF_STYLE_NORMAL
|
static int |
TTF_STYLE_UNDERLINE
|
| Fields inherited from class org.libsdl.SDLStruct |
pointer |
| Constructor Summary | |
TTFFont(java.lang.String filename,
int ptsize)
Create a new TTFFont object from a TrueType font
file and a given point size. |
|
| Method Summary | |
private void |
close()
|
void |
finalize()
Closes the font when the object is garbage collected. |
int |
getAscent()
Get font's ascent. |
int |
getDescent()
Get font's descent. |
int |
getHeight()
Get font's height. |
int |
getLineSkip()
Get font's line skip. |
int |
getStyle()
Get the style of the font. |
private static int |
openFont(java.lang.String filename,
int ptsize)
|
org.libsdl.video.SDLSurface |
renderTextBlended(java.lang.String text,
org.libsdl.video.SDLColor color)
Get font's height. |
void |
setStyle(int style)
Set the style of the font. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
TTF_STYLE_NORMAL
public static int TTF_STYLE_NORMAL
TTF_STYLE_BOLD
public static int TTF_STYLE_BOLD
TTF_STYLE_ITALIC
public static int TTF_STYLE_ITALIC
TTF_STYLE_UNDERLINE
public static int TTF_STYLE_UNDERLINE
| Constructor Detail |
TTFFont
public TTFFont(java.lang.String filename, int ptsize) throws org.libsdl.SDLException, org.libsdl.SDLLibraryNotAvailableException
- Create a new
TTFFontobject from a TrueType font file and a given point size.
| Method Detail |
openFont
private static int openFont(java.lang.String filename, int ptsize)
getStyle
public int getStyle()
- Get the style of the font.
Corresponds:
TTF_GetFontStyle()
setStyle
public void setStyle(int style)
- Set the style of the font.
Corresponds:
TTF_SetFontStyle()
getHeight
public int getHeight()
- Get font's height.
Corresponds:
TTF_FontHeight()
getAscent
public int getAscent()
- Get font's ascent.
Corresponds:
TTF_FontAscent()
getDescent
public int getDescent()
- Get font's descent.
Corresponds:
TTF_FontDescent()
getLineSkip
public int getLineSkip()
- Get font's line skip.
Corresponds:
TTF_FontLineSkip()
renderTextBlended
public org.libsdl.video.SDLSurface renderTextBlended(java.lang.String text, org.libsdl.video.SDLColor color)
- Get font's height.
Corresponds:
TTF_FontHeight()
finalize
public void finalize()
- Closes the font when the object is garbage collected. I'm thinking about
making
closea user-called method rather than having it handled by the Finalizer thread.Corresponds:
TTF_CloseFont()
close
private void close()
|
|||||||||
| Home >> All >> org >> libsdl >> font >> [ ttf overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC