Modifier and Type | Class and Description |
---|---|
static class |
MonospaceGameFont.FontParameters |
static interface |
MonospaceGameFont.FontRenderListener |
Constructor and Description |
---|
MonospaceGameFont(MonospaceGameFont.FontParameters fontParameters) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of this font instance and its resources
|
void |
draw(Graphics g,
org.mini2Dx.gdx.utils.Array<MonospaceGlyph> glyphs,
float x,
float y,
MonospaceGameFont.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,
MonospaceGameFont.FontRenderListener listener) |
void |
draw(Graphics g,
java.lang.String str,
float x,
float y,
float renderWidth,
MonospaceGameFont.FontRenderListener listener) |
float |
getCapHeight()
Returns the height of a capital letter above the baseline
|
Color |
getColor()
Returns the
Color the font will be rendered with |
MonospaceGameFont.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(AssetManager assetManager)
Loads the
GameFont via the AssetManager |
boolean |
load(FileHandle textureHandle)
Loads the
GameFont using the |
boolean |
loadExternal()
Loads the
GameFont using Files.external(String) . |
boolean |
loadInternal()
Loads the
GameFont using Files.internal(String) . |
GameFontCache |
newCache()
Creates a
GameFontCache for this font |
FontGlyphLayout |
newGlyphLayout()
Creates a
FontGlyphLayout for this font |
void |
setColor(Color color)
Sets the
Color to render the font with |
boolean |
useIntegerPositions()
Returns if characters use integer positions
|
public MonospaceGameFont(MonospaceGameFont.FontParameters fontParameters)
public boolean loadInternal()
GameFont
using Files.internal(String)
.
The texture path must be set in the MonospaceGameFont.FontParameters
.loadInternal
in interface GameFont
public boolean loadExternal()
GameFont
using Files.external(String)
.
The texture path must be set in the MonospaceGameFont.FontParameters
.loadExternal
in interface GameFont
public boolean load(FileHandle textureHandle)
GameFont
using thetextureHandle
- public boolean load(AssetManager assetManager)
GameFont
GameFont
via the AssetManager
load
in interface GameFont
assetManager
- The AssetManager
to usepublic 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, MonospaceGameFont.FontRenderListener listener)
public void draw(Graphics g, java.lang.String str, float x, float y, float renderWidth, int horizontalAlignment, boolean wrap, MonospaceGameFont.FontRenderListener listener)
public void draw(Graphics g, org.mini2Dx.gdx.utils.Array<MonospaceGlyph> glyphs, float x, float y, MonospaceGameFont.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 Color getColor()
GameFont
Color
the font will be rendered withpublic void setColor(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 MonospaceGameFont.FontParameters getFontParameters()