public static class BitmapFont.BitmapFontData extends Object
BitmapFont
.Modifier and Type | Field and Description |
---|---|
float |
ascent
The distance from the cap height to the top of the tallest glyph.
|
char[] |
breakChars
Additional characters besides whitespace where text is wrapped.
|
char[] |
capChars |
float |
capHeight
The distance from the top of most uppercase characters to the baseline.
|
float |
cursorX
The amount to add to the glyph X position when drawing a cursor between glyphs.
|
float |
descent
The distance from the bottom of the glyph that extends the lowest to the baseline.
|
float |
down |
boolean |
flipped |
FileHandle |
fontFile |
BitmapFont.Glyph[][] |
glyphs |
String[] |
imagePaths
An array of the image paths, for multiple texture pages.
|
float |
lineHeight
The distance from one line of text to the next.
|
boolean |
markupEnabled |
float |
padBottom |
float |
padLeft |
float |
padRight |
float |
padTop |
float |
scaleX |
float |
scaleY |
float |
spaceWidth
The width of the space character.
|
char[] |
xChars |
float |
xHeight
The x-height, which is the distance from the top of most lowercase characters to the baseline.
|
Constructor and Description |
---|
BitmapFontData()
Creates an empty BitmapFontData for configuration before calling
load(FileHandle, boolean) , to subclass, or to
populate yourself, e.g. |
BitmapFontData(FileHandle fontFile,
boolean flip) |
Modifier and Type | Method and Description |
---|---|
BitmapFont.Glyph |
getFirstGlyph() |
FileHandle |
getFontFile() |
BitmapFont.Glyph |
getGlyph(char ch)
Returns the glyph for the specified character, or null if no such glyph exists.
|
void |
getGlyphs(GlyphLayout.GlyphRun run,
CharSequence str,
int start,
int end)
Using the specified string, populates the glyphs and positions of the specified glyph run.
|
String |
getImagePath(int index)
Returns the image path for the texture page at the given index (the "id" in the BMFont file).
|
String[] |
getImagePaths() |
int |
getWrapIndex(Array<BitmapFont.Glyph> glyphs,
int start)
Returns the first valid glyph index to use to wrap to the next line, starting at the specified start index and
(typically) moving toward the beginning of the glyphs array.
|
boolean |
hasGlyph(char ch) |
boolean |
isBreakChar(char c) |
boolean |
isWhitespace(char c) |
void |
load(FileHandle fontFile,
boolean flip) |
void |
scale(float amount)
Sets the font's scale relative to the current scale.
|
void |
setGlyph(int ch,
BitmapFont.Glyph glyph) |
void |
setGlyphRegion(BitmapFont.Glyph glyph,
TextureRegion region) |
void |
setLineHeight(float height)
Sets the line height, which is the distance from one line of text to the next.
|
void |
setScale(float scaleXY)
Scales the font by the specified amount in both directions.
|
void |
setScale(float scaleX,
float scaleY)
Scales the font by the specified amounts on both axes
|
public String[] imagePaths
public FileHandle fontFile
public boolean flipped
public float padTop
public float padRight
public float padBottom
public float padLeft
public float lineHeight
public float capHeight
public float ascent
public float descent
public float down
public float scaleX
public float scaleY
public boolean markupEnabled
public float cursorX
public final BitmapFont.Glyph[][] glyphs
public float spaceWidth
public float xHeight
public char[] breakChars
public char[] xChars
public char[] capChars
public BitmapFontData()
load(FileHandle, boolean)
, to subclass, or to
populate yourself, e.g. using stb-truetype or FreeType.public BitmapFontData(FileHandle fontFile, boolean flip)
public void load(FileHandle fontFile, boolean flip)
public void setGlyphRegion(BitmapFont.Glyph glyph, TextureRegion region)
public void setLineHeight(float height)
public void setGlyph(int ch, BitmapFont.Glyph glyph)
public BitmapFont.Glyph getFirstGlyph()
public boolean hasGlyph(char ch)
public BitmapFont.Glyph getGlyph(char ch)
#getGlyphs(GlyphRun, CharSequence, int, int)
should be be used to shape a string of characters into a list of
glyphs.public void getGlyphs(GlyphLayout.GlyphRun run, CharSequence str, int start, int end)
str
- Characters to convert to glyphs. Will not contain newline or color tags. May contain "[[" for an escaped left
square bracket.public int getWrapIndex(Array<BitmapFont.Glyph> glyphs, int start)
public boolean isBreakChar(char c)
public boolean isWhitespace(char c)
public String getImagePath(int index)
public String[] getImagePaths()
public FileHandle getFontFile()
public void setScale(float scaleX, float scaleY)
Note that smoother scaling can be achieved if the texture backing the BitmapFont is using Texture.TextureFilter.Linear
.
The default is Nearest, so use a BitmapFont constructor that takes a TextureRegion
.
IllegalArgumentException
- if scaleX or scaleY is zero.public void setScale(float scaleXY)
IllegalArgumentException
- if scaleX or scaleY is zero.setScale(float, float)
public void scale(float amount)
IllegalArgumentException
- if the resulting scale is zero.setScale(float, float)
Copyright © 2015. All rights reserved.