sdljava.ttf
public class SDLTrueTypeFont extends Object
Note: glyphMetrics() method currently is not working.
Version: $Id: SDLTrueTypeFont.java,v 1.4 2004/12/29 19:11:53 ivan_ganza Exp $
See Also: SDLTTF
Field Summary | |
---|---|
String | path |
int | ptsize |
SWIGTYPE_p__TTF_Font | swigTTFFont |
static int | TTF_STYLE_BOLD |
static int | TTF_STYLE_ITALIC |
static int | TTF_STYLE_NORMAL |
static int | TTF_STYLE_UNDERLINE |
Constructor Summary | |
---|---|
protected | SDLTrueTypeFont(SWIGTYPE_p__TTF_Font swigTTFFont, String path, int ptsize)
Creates a new SDLTrueTypeFont instance.
|
Method Summary | |
---|---|
void | closeFont()
Free the memory used by font, and free font itself as well. |
protected void | finalize() |
int | fontAscent()
Get the maximum pixel ascent of all glyphs of the loaded
font. |
int | fontDescent()
Get the maximum pixel descent of all glyphs of the loaded
font. |
int | fontHeight()
Get the maximum pixel height of all glyphs of the loaded
font. |
int | fontLineSkip()
et the reccomended pixel height of a rendered line of text of
the loaded font. |
int | getFontStyle()
Get the rendering style of the loaded font.
|
String | getPath()
Get the path to the font file
|
int | getPTSize()
Get the pt size
|
SWIGTYPE_p__TTF_Font | getSwigTTFFont()
Gets the value of swigTTFFont
|
GlyphMetrics | glyphMetrics(char c)
Gets the glyph metrics from the font file.
|
SDLSurface | renderTextBlended(String text, SDLColor fg)
Create a 32-bit ARGB surface and render the given glyph at
high quality, using alpha blending to dither the font with the
given color. |
SDLSurface | renderTextShaded(String text, SDLColor fg, SDLColor bg)
Create an 8-bit palettized surface and render the given text
at fast quality with the given font and color. |
SDLSurface | renderTextSolid(String text, SDLColor fg)
Create an 8-bit palettized surface and render the given text
at fast quality with the given font and color. |
void | setFontStyle(int style)
Set the rendering style of the loaded font.
|
void | setSwigTTFFont(SWIGTYPE_p__TTF_Font argSwigTTFFont)
Sets the value of swigTTFFont
|
String | toString()
Return a string represenation of this object
|
SDLTrueTypeFont
instance.
Parameters: swigTTFFont a SWIGTYPE_p__TTF_Font
value
Parameters: font The font to free
Throws: SDLException if an error occurs
rect.y = top + TTF_FontAscent(font) - glyph_metric.maxy;
Returns: The maximum pixel ascent of all glyphs in the font.
rect.y = bottom - TTF_FontDescent(font) - glyph_metric.maxy;
Returns: The maximum pixel height of all glyphs in the font.
Returns: The maximum pixel height of all glyphs in the font.
Returns: The maximum pixel height of all glyphs in the font.
Returns: The style as a bitmask composed of the TTF_* defines
Throws: SDLException if an error occurs
Returns: the path to the font file
Returns: the pt size
Returns: the value of swigTTFFont
Parameters: c a char
value
Returns: the glyph metrics from the font file as a GlyphMetrics
value
Throws: SDLException if an error occurs
Parameters: text The text to render fg The foreground color
Returns: a SDLSurface
with the rendered text
Throws: SDLException if an error occurs
Parameters: text a String
value fg a SDLColor
value bg a SDLColor
value
Returns: a SDLSurface
value
Throws: SDLException if an error occurs
Parameters: text The text to render fg The foreground color
Returns: a SDLSurface
with the rendered text
Throws: SDLException if an error occurs
NOTE: This will flush the internal cache of previously rendered glyphs, even if there is no change in style, so it may be best to check the current style using TTF_GetFontStyle first.
NOTE: I've seen that combining TTF_STYLE_UNDERLINE with anything can cause a segfault, other combinations may also do this. Some brave soul may find the cause of this and fix it...
NOTE: Rendered text formatted with TTF_STYLE_BOLD is hollow on the inside (wireframe like) for some reason when you use TTF_?RenderSolid. It displayed ok if you use TTF_?RenderBlended.
Parameters: style A bitmask of the desired style composed from the TTF_STYLE_* defined values.
Throws: SDLException if an error occurs
Parameters: argSwigTTFFont Value to assign to this.swigTTFFont
Returns: a String represenation of this object