Class AngelCodeFont
java.lang.Object
zombie.core.fonts.AngelCodeFont
- All Implemented Interfaces:
AssetStateObserver, Font
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThe definition of a single character as defined in the AngelCode file formatstatic final class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAngelCodeFont(String fntFile, String imgFile) Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.AngelCodeFont(String fntFile, Texture image) Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()voiddrawString(float x, float y, float scale, String text, float r, float g, float b, float a) voiddrawString(float x, float y, float scale, String text, float r, float g, float b, float a, int startIndex, int endIndex) voiddrawString(float x, float y, String text) Description copied from interface: FontvoiddrawString(float x, float y, String text, float r, float g, float b, float a) voiddrawString(float x, float y, String text, float r, float g, float b, float a, int startIndex, int endIndex) voiddrawString(float x, float y, String text, Color col) Description copied from interface: FontvoiddrawString(float x, float y, String text, Color col, int startIndex, int endIndex) Description copied from interface: FontintDescription copied from interface: FontintintDescription copied from interface: FontintDescription copied from interface: FontintintintintgetYOffset(String text) Returns the distance from the y drawing location to the top most pixel of the specified text.booleanisEmpty()booleanisSdf()voidonStateChanged(Asset.State oldState, Asset.State newState, Asset asset) voidsetSdf(boolean b)
-
Field Details
-
chars
The characters building up the font -
xoff
public static int xoff -
yoff
public static int yoff -
curCol
-
curR
public static float curR -
curG
public static float curG -
curB
public static float curB -
curA
public static float curA
-
-
Constructor Details
-
AngelCodeFont
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.- Parameters:
fntFile- The image to use for the fontthis- The location of the font defnition file- Throws:
FileNotFoundException
-
AngelCodeFont
Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.- Parameters:
fntFile- The location of the font imagethis- The location of the font defnition file- Throws:
FileNotFoundException
-
-
Method Details
-
drawString
Description copied from interface: Font- Specified by:
drawStringin interfaceFont- Parameters:
x- The x location at which to draw the stringy- The y location at which to draw the stringtext- The text to be displayed
-
drawString
Description copied from interface: Font- Specified by:
drawStringin interfaceFont- Parameters:
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 with
-
drawString
-
drawString
public void drawString(float x, float y, float scale, String text, float r, float g, float b, float a) -
drawString
Description copied from interface: Font- Specified by:
drawStringin interfaceFont- Parameters:
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 draw
-
drawString
public void drawString(float x, float y, String text, float r, float g, float b, float a, int startIndex, int endIndex) -
drawString
public void drawString(float x, float y, float scale, String text, float r, float g, float b, float a, int startIndex, int endIndex) -
getHeight
-
getHeight
-
getLineHeight
public int getLineHeight()Description copied from interface: Font- Specified by:
getLineHeightin interfaceFont- Returns:
- The maxium height of any line drawn by this font
-
getWidth
-
getWidth
-
getWidth
-
getWidth
-
getYOffset
Returns the distance from the y drawing location to the top most pixel of the specified text.- Parameters:
text- The text that is to be tested- Returns:
- The yoffset from the y draw location at which text will start
-
onStateChanged
- Specified by:
onStateChangedin interfaceAssetStateObserver
-
isEmpty
public boolean isEmpty() -
isSdf
public boolean isSdf() -
setSdf
public void setSdf(boolean b) -
destroy
public void destroy()
-