public class GlyphLayout extends Object implements Pool.Poolable
runs
of glyphs for a piece of text. The text may contain newlines and color markup tags.Modifier and Type | Class and Description |
---|---|
static class |
GlyphLayout.GlyphRun
Stores glyphs and positions for a piece of text which is a single color and does not span multiple lines.
|
Modifier and Type | Field and Description |
---|---|
float |
height |
Array<GlyphLayout.GlyphRun> |
runs |
float |
width |
Constructor and Description |
---|
GlyphLayout()
Creates an empty GlyphLayout.
|
GlyphLayout(BitmapFont font,
CharSequence str) |
GlyphLayout(BitmapFont font,
CharSequence str,
Color color,
float targetWidth,
int halign,
boolean wrap) |
GlyphLayout(BitmapFont font,
CharSequence str,
int start,
int end,
Color color,
float targetWidth,
int halign,
boolean wrap,
String truncate) |
Modifier and Type | Method and Description |
---|---|
void |
reset()
Resets the object for reuse.
|
void |
setText(BitmapFont font,
CharSequence str)
Calls
setText with the whole
string, the font's current color, and no alignment or wrapping. |
void |
setText(BitmapFont font,
CharSequence str,
Color color,
float targetWidth,
int halign,
boolean wrap)
Calls
setText with the whole
string and no truncation. |
void |
setText(BitmapFont font,
CharSequence str,
int start,
int end,
Color color,
float targetWidth,
int halign,
boolean wrap,
String truncate) |
String |
toString() |
public final Array<GlyphLayout.GlyphRun> runs
public float width
public float height
public GlyphLayout()
public GlyphLayout(BitmapFont font, CharSequence str)
setText(BitmapFont, CharSequence)
public GlyphLayout(BitmapFont font, CharSequence str, Color color, float targetWidth, int halign, boolean wrap)
setText(BitmapFont, CharSequence)
public GlyphLayout(BitmapFont font, CharSequence str, int start, int end, Color color, float targetWidth, int halign, boolean wrap, String truncate)
setText(BitmapFont, CharSequence)
public void setText(BitmapFont font, CharSequence str)
setText
with the whole
string, the font's current color, and no alignment or wrapping.public void setText(BitmapFont font, CharSequence str, Color color, float targetWidth, int halign, boolean wrap)
setText
with the whole
string and no truncation.public void setText(BitmapFont font, CharSequence str, int start, int end, Color color, float targetWidth, int halign, boolean wrap, String truncate)
color
- The default color to use for the text (the BitmapFont color
is not used). If
BitmapFont.BitmapFontData.markupEnabled
is true, color markup tags in the specified string may change the color for
portions of the text.halign
- Horizontal alignment of the text, see Align
.targetWidth
- The width used for alignment, line wrapping, and truncation. May be zero if those features are not used.truncate
- If not null and the width of the glyphs exceed targetWidth, the glyphs are truncated and the glyphs for the
specified truncate string are placed at the end. Empty string can be used to truncate without adding glyphs.
Truncate should not be used with text that contains multiple lines. Wrap is ignored if truncate is not null.public void reset()
Pool.Poolable
reset
in interface Pool.Poolable
Copyright © 2016. All rights reserved.