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.
|
float |
blankLineScale
Multiplier for the line height of blank lines.
|
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
The distance to move down when \n is encountered.
|
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 |
BitmapFont.Glyph |
missingGlyph
The glyph to display for characters not in the font.
|
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,
boolean tightBounds)
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)
Returns true if the font has the glyph, or if the font has a
missingGlyph . |
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
setLineHeight(float)
.public float capHeight
public float ascent
public float descent
public float down
public float blankLineScale
public float scaleX
public float scaleY
public boolean markupEnabled
public float cursorX
public final BitmapFont.Glyph[][] glyphs
public BitmapFont.Glyph missingGlyph
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)
missingGlyph
.public BitmapFont.Glyph getGlyph(char ch)
#getGlyphs(GlyphRun, CharSequence, int, int, boolean)
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, boolean tightBounds)
str
- Characters to convert to glyphs. Will not contain newline or color tags. May contain "[[" for an escaped left
square bracket.tightBounds
- If true, the first GlyphLayout.GlyphRun.xAdvances
entry is offset to prevent the first glyph from being
drawn left of 0 and the last entry is offset to prevent the last glyph from being drawn right of the run
width.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 © 2016. All rights reserved.