Package com.jme3.font

Class BitmapText

All Implemented Interfaces:
HasLocalTransform, CloneableSmartAsset, Collidable, Savable, JmeCloneable, Cloneable

public class BitmapText extends Node
  • Constructor Details

    • BitmapText

      public BitmapText(BitmapFont font)
    • BitmapText

      @Deprecated public BitmapText(BitmapFont font, boolean rightToLeft)
      Deprecated.
      The "rightToLeft" flag should be specified in the font. Use BitmapText(com.jme3.font.BitmapFont)
      Parameters:
      font - the font to use (not null, alias created)
      rightToLeft - true → right-to-left, false → left-to-right (default=false)
    • BitmapText

      public BitmapText(BitmapFont font, boolean rightToLeft, boolean arrayBased)
  • Method Details

    • clone

      public BitmapText clone()
      Description copied from interface: CloneableSmartAsset
      Creates a clone of the asset. Please see Object.clone() for more info on how this method should be implemented.
      Specified by:
      clone in interface CloneableSmartAsset
      Overrides:
      clone in class Spatial
      Returns:
      A clone of this Spatial, the scene graph in its entirety is cloned and can be altered independently of the original scene graph. Note that meshes of geometries are not cloned explicitly, they are shared if static, or specially cloned if animated.
      See Also:
    • cloneFields

      public void cloneFields(Cloner cloner, Object original)
      Called internally by com.jme3.util.clone.Cloner. Do not call directly.
      Specified by:
      cloneFields in interface JmeCloneable
      Overrides:
      cloneFields in class Node
      Parameters:
      cloner - The cloner that is performing the cloning operation. The cloneFields method can call back into the cloner to make clones of its subordinate fields.
      original - The original object from which this object was cloned. This is provided for the very rare case that this object needs to refer to its original for some reason. In general, all of the relevant values should have been transferred during the shallow clone, and this object need only clone what it wants.
    • getFont

      public BitmapFont getFont()
    • setSize

      public void setSize(float size)
      Changes text size
      Parameters:
      size - text size
    • getSize

      public float getSize()
    • setText

      public void setText(CharSequence text)
      Parameters:
      text - charsequence to change text to
    • setText

      public void setText(String text)
      Parameters:
      text - String to change text to
    • getText

      public String getText()
      Returns:
      returns text
    • getColor

      public ColorRGBA getColor()
      Returns:
      color of the text
    • setColor

      public void setColor(ColorRGBA color)
      changes text color. all substring colors are deleted.
      Parameters:
      color - new color of text
    • setAlpha

      public void setAlpha(float alpha)
      Sets an overall alpha that will be applied to all letters. If the alpha passed is -1 then alpha reverts to default... which will be 1 for anything unspecified and color tags will be reset to 1 or their encoded alpha.
      Parameters:
      alpha - the desired alpha, or -1 to revert to the default
    • getAlpha

      public float getAlpha()
    • setBox

      public void setBox(Rectangle rect)
      Define the area where the BitmapText will be rendered.
      Parameters:
      rect - position and size box where text is rendered
    • getLineHeight

      public float getLineHeight()
      Returns:
      height of the line
    • getHeight

      public float getHeight()
      Returns:
      height of whole text block
    • getLineWidth

      public float getLineWidth()
      Returns:
      width of line
    • getLineCount

      public int getLineCount()
      Returns:
      line count
    • getLineWrapMode

      public LineWrapMode getLineWrapMode()
    • setAlignment

      public void setAlignment(BitmapFont.Align align)
      Set horizontal alignment. Applicable only when text bound is set.
      Parameters:
      align - the desired alignment (such as Align.Left)
    • setVerticalAlignment

      public void setVerticalAlignment(BitmapFont.VAlign align)
      Set vertical alignment. Applicable only when text bound is set.
      Parameters:
      align - the desired alignment (such as Align.Top)
    • getAlignment

      public BitmapFont.Align getAlignment()
    • getVerticalAlignment

      public BitmapFont.VAlign getVerticalAlignment()
    • setStyle

      public void setStyle(int start, int end, int style)
      Set the font style of substring. If font doesn't contain style, default style is used
      Parameters:
      start - start index to set style. inclusive.
      end - end index to set style. EXCLUSIVE.
      style - the style to apply
    • setStyle

      public void setStyle(String regexp, int style)
      Set the font style of substring. If font doesn't contain style, default style is applied
      Parameters:
      regexp - regular expression
      style - the style to apply
    • setColor

      public void setColor(int start, int end, ColorRGBA color)
      Set the color of substring.
      Parameters:
      start - start index to set style. inclusive.
      end - end index to set style. EXCLUSIVE.
      color - the desired color
    • setColor

      public void setColor(String regexp, ColorRGBA color)
      Set the color of substring.
      Parameters:
      regexp - regular expression
      color - the desired color
    • setTabPosition

      public void setTabPosition(float... tabs)
      Parameters:
      tabs - tab positions
    • setTabWidth

      public void setTabWidth(float width)
      used for the tabs over the last tab position.
      Parameters:
      width - tab size
    • setEllipsisChar

      public void setEllipsisChar(char c)
      for setLineWrapType(LineWrapType.NoWrap), set the last character when the text exceeds the bound.
      Parameters:
      c - the character to indicate truncated text
    • setLineWrapMode

      public void setLineWrapMode(LineWrapMode wrap)
      Available only when bounding is set. setBox() method call is needed in advance. true when
      Parameters:
      wrap - NoWrap : Letters over the text bound is not shown. the last character is set to '...'(0x2026) Character: Character is split at the end of the line. Word : Word is split at the end of the line. Clip : The text is hard-clipped at the border including showing only a partial letter if it goes beyond the text bound.
    • updateLogicalState

      public void updateLogicalState(float tpf)
      Description copied from class: Spatial
      updateLogicalState calls the update() method for all controls attached to this Spatial.
      Overrides:
      updateLogicalState in class Node
      Parameters:
      tpf - Time per frame.
      See Also:
    • render

      public void render(RenderManager rm, ColorRGBA color)