public class MonospaceFont extends java.lang.Object implements GameFont
BitmapFont
except every character is a fixed-width which simplifies rendering calculationsModifier and Type | Class and Description |
---|---|
static class |
MonospaceFont.FontParameters |
static interface |
MonospaceFont.FontRenderListener |
Constructor and Description |
---|
MonospaceFont(MonospaceFont.FontParameters fontParameters) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of this font instance and its resources
|
void |
draw(Graphics g,
com.badlogic.gdx.utils.Array<MonospaceGlyph> glyphs,
float x,
float y,
MonospaceFont.FontRenderListener listener) |
void |
draw(Graphics g,
java.lang.String str,
float x,
float y)
Draws text to the
Graphics context using this font |
void |
draw(Graphics g,
java.lang.String str,
float x,
float y,
float renderWidth)
Draws text to the
Graphics context using this font |
void |
draw(Graphics g,
java.lang.String str,
float x,
float y,
float renderWidth,
int horizontalAlignment,
boolean wrap)
Draws text to the
Graphics context using this font |
void |
draw(Graphics g,
java.lang.String str,
float x,
float y,
float renderWidth,
int horizontalAlignment,
boolean wrap,
MonospaceFont.FontRenderListener listener) |
void |
draw(Graphics g,
java.lang.String str,
float x,
float y,
float renderWidth,
MonospaceFont.FontRenderListener listener) |
float |
getCapHeight()
Returns the height of a capital letter above the baseline
|
com.badlogic.gdx.graphics.Color |
getColor()
Returns the
Color the font will be rendered with |
MonospaceFont.FontParameters |
getFontParameters() |
float |
getLineHeight()
Returns the line height of the font
|
FontGlyphLayout |
getSharedGlyphLayout()
Returns a
FontGlyphLayout instance associated with this GameFont instance |
TextureRegion |
getTextureRegion(char c) |
boolean |
load(com.badlogic.gdx.assets.AssetManager assetManager) |
GameFontCache |
newCache()
Creates a
GameFontCache for this font |
FontGlyphLayout |
newGlyphLayout()
Creates a
FontGlyphLayout for this font |
void |
setColor(com.badlogic.gdx.graphics.Color color)
Sets the
Color to render the font with |
boolean |
useIntegerPositions()
Returns if characters use integer positions
|
public MonospaceFont(MonospaceFont.FontParameters fontParameters)
public boolean load(com.badlogic.gdx.assets.AssetManager assetManager)
public void draw(Graphics g, java.lang.String str, float x, float y)
GameFont
Graphics
context using this fontpublic void draw(Graphics g, java.lang.String str, float x, float y, float renderWidth)
GameFont
Graphics
context using this fontpublic void draw(Graphics g, java.lang.String str, float x, float y, float renderWidth, int horizontalAlignment, boolean wrap)
GameFont
Graphics
context using this fontdraw
in interface GameFont
g
- The Graphics
contextstr
- The text to renderx
- The x coordinate to draw aty
- The y coordinate to draw atrenderWidth
- The target width to render withhorizontalAlignment
- The horizontal alignment within the targetWidth. See Align
wrap
- True if text should wrap if exceeding targetWidth, false if it should clippublic void draw(Graphics g, java.lang.String str, float x, float y, float renderWidth, MonospaceFont.FontRenderListener listener)
public void draw(Graphics g, java.lang.String str, float x, float y, float renderWidth, int horizontalAlignment, boolean wrap, MonospaceFont.FontRenderListener listener)
public void draw(Graphics g, com.badlogic.gdx.utils.Array<MonospaceGlyph> glyphs, float x, float y, MonospaceFont.FontRenderListener listener)
public FontGlyphLayout newGlyphLayout()
GameFont
FontGlyphLayout
for this fontnewGlyphLayout
in interface GameFont
FontGlyphLayout
instancepublic FontGlyphLayout getSharedGlyphLayout()
GameFont
FontGlyphLayout
instance associated with this GameFont
instancegetSharedGlyphLayout
in interface GameFont
FontGlyphLayout
instance attached to this fontpublic GameFontCache newCache()
GameFont
GameFontCache
for this fontnewCache
in interface GameFont
GameFontCache
instancepublic com.badlogic.gdx.graphics.Color getColor()
GameFont
Color
the font will be rendered withpublic void setColor(com.badlogic.gdx.graphics.Color color)
GameFont
Color
to render the font withpublic float getLineHeight()
GameFont
getLineHeight
in interface GameFont
public float getCapHeight()
GameFont
getCapHeight
in interface GameFont
public TextureRegion getTextureRegion(char c)
public boolean useIntegerPositions()
GameFont
useIntegerPositions
in interface GameFont
public void dispose()
GameFont
public MonospaceFont.FontParameters getFontParameters()