Package arc.graphics.g2d
Class GlyphLayout
java.lang.Object
arc.graphics.g2d.GlyphLayout
- All Implemented Interfaces:
Pool.Poolable
Stores
runs
of glyphs for a piece of text. The text may contain newlines and color markup tags.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Stores glyphs and positions for a piece of text which is a single color and does not span multiple lines. -
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates an empty GlyphLayout.GlyphLayout
(boolean ignoreMarkup) GlyphLayout
(Font font, CharSequence str) GlyphLayout
(Font font, CharSequence str, int start, int end, Color color, float targetWidth, int halign, boolean wrap, String truncate) GlyphLayout
(Font font, CharSequence str, Color color, float targetWidth, int halign, boolean wrap) -
Method Summary
Modifier and TypeMethodDescriptionvoid
free()
static GlyphLayout
obtain()
void
reset()
Resets the object for reuse.void
setText
(Font font, CharSequence str) void
setText
(Font font, CharSequence str, int start, int end, Color color, float targetWidth, int halign, boolean wrap, String truncate) void
setText
(Font font, CharSequence str, Color color, float targetWidth, int halign, boolean wrap) toString()
-
Field Details
-
runs
-
ignoreMarkup
public boolean ignoreMarkup -
width
public float width -
height
public float height
-
-
Constructor Details
-
GlyphLayout
public GlyphLayout()Creates an empty GlyphLayout. -
GlyphLayout
public GlyphLayout(boolean ignoreMarkup) -
GlyphLayout
-
GlyphLayout
public GlyphLayout(Font font, CharSequence str, Color color, float targetWidth, int halign, boolean wrap) -
GlyphLayout
public GlyphLayout(Font font, CharSequence str, int start, int end, Color color, float targetWidth, int halign, boolean wrap, String truncate)
-
-
Method Details
-
obtain
-
free
public void free() -
setText
-
setText
public void setText(Font font, CharSequence str, Color color, float targetWidth, int halign, boolean wrap) -
setText
public void setText(Font font, CharSequence str, int start, int end, Color color, float targetWidth, int halign, boolean wrap, String truncate) - Parameters:
color
- The default color to use for the text (the BitmapFontcolor
is not used). IfFont.FontData.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, seeAlign
.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.
-
reset
public void reset()Description copied from interface:Pool.Poolable
Resets the object for reuse. Object references should be nulled and fields may be set to default values.- Specified by:
reset
in interfacePool.Poolable
-
toString
-