Class GlyphLayout

  • All Implemented Interfaces:
    com.badlogic.gdx.utils.Pool.Poolable

    public class GlyphLayout
    extends java.lang.Object
    implements com.badlogic.gdx.utils.Pool.Poolable
    Stores runs of glyphs for a piece of text. The text may contain newlines and color markup tags.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class 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.
    • Constructor Summary

      Constructors 
      Constructor Description
      GlyphLayout()
      Creates an empty GlyphLayout.
      GlyphLayout​(BitmapFont font, java.lang.CharSequence str)  
      GlyphLayout​(BitmapFont font, java.lang.CharSequence str, int start, int end, com.badlogic.gdx.graphics.Color color, float targetWidth, int halign, boolean wrap, java.lang.String truncate)  
      GlyphLayout​(BitmapFont font, java.lang.CharSequence str, com.badlogic.gdx.graphics.Color color, float targetWidth, int halign, boolean wrap)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void reset()  
      void setText​(BitmapFont font, java.lang.CharSequence str)
      Calls setText with the whole string, the font's current color, and no alignment or wrapping.
      void setText​(BitmapFont font, java.lang.CharSequence str, int start, int end, com.badlogic.gdx.graphics.Color color, float targetWidth, int halign, boolean wrap, java.lang.String truncate)  
      void setText​(BitmapFont font, java.lang.CharSequence str, com.badlogic.gdx.graphics.Color color, float targetWidth, int halign, boolean wrap)
      Calls setText with the whole string and no truncation.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • width

        public float width
      • height

        public float height
    • Constructor Detail

      • GlyphLayout

        public GlyphLayout()
        Creates an empty GlyphLayout.
      • GlyphLayout

        public GlyphLayout​(BitmapFont font,
                           java.lang.CharSequence str,
                           com.badlogic.gdx.graphics.Color color,
                           float targetWidth,
                           int halign,
                           boolean wrap)
        See Also:
        setText(BitmapFont, CharSequence)
      • GlyphLayout

        public GlyphLayout​(BitmapFont font,
                           java.lang.CharSequence str,
                           int start,
                           int end,
                           com.badlogic.gdx.graphics.Color color,
                           float targetWidth,
                           int halign,
                           boolean wrap,
                           java.lang.String truncate)
        See Also:
        setText(BitmapFont, CharSequence)
    • Method Detail

      • setText

        public void setText​(BitmapFont font,
                            java.lang.CharSequence str)
        Calls setText with the whole string, the font's current color, and no alignment or wrapping.
      • setText

        public void setText​(BitmapFont font,
                            java.lang.CharSequence str,
                            com.badlogic.gdx.graphics.Color color,
                            float targetWidth,
                            int halign,
                            boolean wrap)
        Calls setText with the whole string and no truncation.
      • setText

        public void setText​(BitmapFont font,
                            java.lang.CharSequence str,
                            int start,
                            int end,
                            com.badlogic.gdx.graphics.Color color,
                            float targetWidth,
                            int halign,
                            boolean wrap,
                            java.lang.String truncate)
        Parameters:
        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.
      • reset

        public void reset()
        Specified by:
        reset in interface com.badlogic.gdx.utils.Pool.Poolable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object