public class AngelCodeFont extends java.lang.Object implements Font
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public AngelCodeFont(java.lang.String fntFile, Image image) throws SlickException
fntFile
- The location of the font defnition fileimage
- The image to use for the fontSlickException
- 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 imageSlickException
- 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 cachingSlickException
- 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 cachingSlickException
- 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 imageSlickException
- 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 cachingSlickException
- Indicates a failure to load either filepublic 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 displayedpublic 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 withpublic 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 drawpublic int getYOffset(java.lang.String text)
text
- The text that is to be testedpublic int getHeight(java.lang.String text)
Font
public int getWidth(java.lang.String text)
Font
public int getLineHeight()
Font
getLineHeight
in interface Font