|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.AngelCodeFont
public class AngelCodeFont
A font implementation that will parse BMFont format font files. The font files can be output by Hiero, which is included with Slick, and also the AngelCode font tool available at: http://www.angelcode.com/products/bmfont/ This implementation copes with both the font display and kerning information allowing nicer looking paragraphs of text. Note that this utility only supports the text BMFont format definition file.
Constructor Summary | |
---|---|
AngelCodeFont(java.lang.String fntFile,
Image image)
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool. |
|
AngelCodeFont(java.lang.String fntFile,
Image image,
boolean caching)
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool. |
|
AngelCodeFont(java.lang.String name,
java.io.InputStream fntFile,
java.io.InputStream imgFile)
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool. |
|
AngelCodeFont(java.lang.String name,
java.io.InputStream fntFile,
java.io.InputStream imgFile,
boolean caching)
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool. |
|
AngelCodeFont(java.lang.String fntFile,
java.lang.String imgFile)
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool. |
|
AngelCodeFont(java.lang.String fntFile,
java.lang.String imgFile,
boolean caching)
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool. |
Method Summary | |
---|---|
void |
drawString(float x,
float y,
java.lang.String text)
Draw a string to the screen |
void |
drawString(float x,
float y,
java.lang.String text,
Color col)
Draw a string to the screen |
void |
drawString(float x,
float y,
java.lang.String text,
Color col,
int startIndex,
int endIndex)
Draw part of a string to the screen. |
int |
getHeight(java.lang.String text)
Get the height of the given string |
int |
getLineHeight()
Get the maximum height of any line drawn by this font |
int |
getWidth(java.lang.String text)
Get the width of the given string |
int |
getYOffset(java.lang.String text)
Returns the distance from the y drawing location to the top most pixel of the specified text. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AngelCodeFont(java.lang.String fntFile, Image image) throws SlickException
fntFile
- The location of the font defnition fileimage
- The image to use for the font
SlickException
- Indicates a failure to load either filepublic AngelCodeFont(java.lang.String fntFile, java.lang.String imgFile) throws SlickException
fntFile
- The location of the font defnition fileimgFile
- The location of the font image
SlickException
- Indicates a failure to load either filepublic AngelCodeFont(java.lang.String fntFile, Image image, boolean caching) throws SlickException
fntFile
- The location of the font defnition fileimage
- The image to use for the fontcaching
- True if this font should use display list caching
SlickException
- Indicates a failure to load either filepublic AngelCodeFont(java.lang.String fntFile, java.lang.String imgFile, boolean caching) throws SlickException
fntFile
- The location of the font defnition fileimgFile
- The location of the font imagecaching
- True if this font should use display list caching
SlickException
- Indicates a failure to load either filepublic AngelCodeFont(java.lang.String name, java.io.InputStream fntFile, java.io.InputStream imgFile) throws SlickException
name
- The name to assign to the font image in the image storefntFile
- The stream of the font defnition fileimgFile
- The stream of the font image
SlickException
- Indicates a failure to load either filepublic AngelCodeFont(java.lang.String name, java.io.InputStream fntFile, java.io.InputStream imgFile, boolean caching) throws SlickException
name
- The name to assign to the font image in the image storefntFile
- The stream of the font defnition fileimgFile
- The stream of the font imagecaching
- True if this font should use display list caching
SlickException
- Indicates a failure to load either fileMethod Detail |
---|
public void drawString(float x, float y, java.lang.String text)
Font
drawString
in interface Font
x
- The x location at which to draw the stringy
- The y location at which to draw the stringtext
- The text to be displayedFont.drawString(float, float, java.lang.String)
public void drawString(float x, float y, java.lang.String text, Color col)
Font
drawString
in interface Font
x
- The x location at which to draw the stringy
- The y location at which to draw the stringtext
- The text to be displayedcol
- The colour to draw withFont.drawString(float, float, java.lang.String,
org.newdawn.slick.Color)
public void drawString(float x, float y, java.lang.String text, Color col, int startIndex, int endIndex)
Font
drawString
in interface Font
x
- The x location at which to draw the stringy
- The y location at which to draw the stringtext
- The text to be displayedcol
- The colour to draw withstartIndex
- The index of the first character to drawendIndex
- The index of the last character from the string to drawFont.drawString(float, float, String, Color, int, int)
public int getYOffset(java.lang.String text)
text
- The text that is to be tested
public int getHeight(java.lang.String text)
Font
getHeight
in interface Font
text
- The string to obtain the rendered with of
Font.getHeight(java.lang.String)
public int getWidth(java.lang.String text)
Font
getWidth
in interface Font
text
- The string to obtain the rendered with of
Font.getWidth(java.lang.String)
public int getLineHeight()
Font
getLineHeight
in interface Font
Font.getLineHeight()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |