Class BitmapFont
- java.lang.Object
-
- nl.colorize.multimedialib.graphics.BitmapFont
-
- All Implemented Interfaces:
TextFont
public class BitmapFont extends java.lang.Object implements TextFont
Describes a font that consists of a number of images. This type of font is generally used for environments that do not support rendering TrueType fonts, though the performance of bitmap fonts also tends to be better.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BitmapFontderive(int newSize)Returns a version of this font that uses the same font family and color, but has a different size.BitmapFontderive(ColorRGB newColor)Returns a version of this font which uses the same font family and size, but has a different color.BitmapFontderiveBold()Returns a bold version of this font.voiddraw(GraphicsContext context, java.lang.String text, float x, float y, Align align, AlphaTransform alpha)Draws a text with this bitmap font using the specified graphics context.protected intgetBase()protected RectgetBounds(char c)java.lang.StringgetFamily()protected intgetLineHeight()intgetSize()static BitmapFontparseFNT(Image image, java.lang.String fntMetadata)Creates a bitmap font from an image and metadata parsed from a.fntfile using the AngelCode font format.
-
-
-
Method Detail
-
getLineHeight
protected int getLineHeight()
-
getBase
protected int getBase()
-
getBounds
protected Rect getBounds(char c)
-
derive
public BitmapFont derive(int newSize)
Description copied from interface:TextFontReturns a version of this font that uses the same font family and color, but has a different size.
-
derive
public BitmapFont derive(ColorRGB newColor)
Description copied from interface:TextFontReturns a version of this font which uses the same font family and size, but has a different color.
-
deriveBold
public BitmapFont deriveBold()
Description copied from interface:TextFontReturns a bold version of this font. All all properties will be identical to the current font.- Specified by:
deriveBoldin interfaceTextFont
-
draw
public void draw(GraphicsContext context, java.lang.String text, float x, float y, Align align, AlphaTransform alpha)
Draws a text with this bitmap font using the specified graphics context. This method will trigger several drawing operations to draw the various sub-images.
-
parseFNT
public static BitmapFont parseFNT(Image image, java.lang.String fntMetadata)
Creates a bitmap font from an image and metadata parsed from a.fntfile using the AngelCode font format. AngelCode fonts can be created using various tools, such as libGDX Hiero (https://github.com/libgdx/libgdx/wiki/Hiero).- Throws:
MediaException- if the font metadata cannot be parsed.
-
-