|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sdljava.ttf.SDLTrueTypeFont
public class SDLTrueTypeFont
An instance of TTF_Font. All functions which operate on a TTF_Font structure from SDL_ttf may be found in this class.
Note: glyphMetrics() method currently is not working.
SDLTTF
Field Summary | |
---|---|
(package private) java.lang.String |
path
|
(package private) int |
ptsize
|
(package private) 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,
java.lang.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. |
java.lang.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(java.lang.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(java.lang.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(java.lang.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 |
java.lang.String |
toString()
Return a string represenation of this object |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TTF_STYLE_NORMAL
public static final int TTF_STYLE_BOLD
public static final int TTF_STYLE_ITALIC
public static final int TTF_STYLE_UNDERLINE
SWIGTYPE_p__TTF_Font swigTTFFont
java.lang.String path
int ptsize
Constructor Detail |
---|
protected SDLTrueTypeFont(SWIGTYPE_p__TTF_Font swigTTFFont, java.lang.String path, int ptsize)
SDLTrueTypeFont
instance.
swigTTFFont
- a SWIGTYPE_p__TTF_Font
valueMethod Detail |
---|
public SWIGTYPE_p__TTF_Font getSwigTTFFont()
public void setSwigTTFFont(SWIGTYPE_p__TTF_Font argSwigTTFFont)
argSwigTTFFont
- Value to assign to this.swigTTFFontpublic java.lang.String getPath()
public int getPTSize()
public SDLSurface renderTextSolid(java.lang.String text, SDLColor fg) throws SDLException
text
- The text to renderfg
- The foreground color
SDLSurface
with the rendered text
SDLException
- if an error occurspublic SDLSurface renderTextShaded(java.lang.String text, SDLColor fg, SDLColor bg) throws SDLException
text
- a String
valuefg
- a SDLColor
valuebg
- a SDLColor
value
SDLSurface
value
SDLException
- if an error occurspublic SDLSurface renderTextBlended(java.lang.String text, SDLColor fg) throws SDLException
text
- The text to renderfg
- The foreground color
SDLSurface
with the rendered text
SDLException
- if an error occurspublic void setFontStyle(int style) throws SDLException
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.
style
- A bitmask of the desired style composed from the TTF_STYLE_* defined values.
SDLException
- if an error occurspublic int getFontStyle()
SDLException
- if an error occurspublic int fontHeight()
public int fontAscent()
rect.y = top + TTF_FontAscent(font) - glyph_metric.maxy;
public int fontDescent()
rect.y = bottom - TTF_FontDescent(font) - glyph_metric.maxy;
public int fontLineSkip()
public GlyphMetrics glyphMetrics(char c) throws SDLException
c
- a char
value
GlyphMetrics
value
SDLException
- if an error occurspublic void closeFont() throws SDLException
font
- The font to free
SDLException
- if an error occurspublic java.lang.String toString()
toString
in class java.lang.Object
protected void finalize()
finalize
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |