Class RMTextLine

All Implemented Interfaces:
Shape, Serializable, CharSequence, Cloneable

public class RMTextLine extends RMTextRun
A class to represent a line of text in a layout.
See Also:
  • Constructor Details

    • RMTextLine

      public RMTextLine()
  • Method Details

    • addChars

      public int addChars(RMXStringRun aRun, int aStart, int anEnd)
      Adds chars to text line.
      Overrides:
      addChars in class RMTextRun
    • addChar

      protected void addChar(char aChar, double aWidth)
      Adds a char to text line.
      Overrides:
      addChar in class RMTextRun
    • charAt

      public char charAt(int anIndex)
      Returns the char value at the specified index.
      Specified by:
      charAt in interface CharSequence
      Overrides:
      charAt in class RMTextRun
    • subSequence

      public CharSequence subSequence(int aStart, int anEnd)
      Returns a new char sequence that is a subsequence of this sequence.
      Specified by:
      subSequence in interface CharSequence
      Overrides:
      subSequence in class RMTextRun
    • setBounds

      protected void setBounds(double anX, double aY, double aWidth, double aHeight)
      Sets the bounds of this layout.
    • getYBaseline

      public double getYBaseline()
      Returns the y position for this line (in same coords as the layout frame).
      Overrides:
      getYBaseline in class RMTextRun
    • getHitMaxX

      public double getHitMaxX()
      Returns the max x position possible for layout's path. Override if not just layout max.
    • getNext

      public RMTextLine getNext()
      Returns the next run.
      Overrides:
      getNext in class RMTextRun
    • getRunCount

      public int getRunCount()
      Returns the number of runs in this line.
      Overrides:
      getRunCount in class RMTextRun
    • getRun

      public RMTextRun getRun(int anIndex)
      Returns the text run at the given index.
      Overrides:
      getRun in class RMTextRun
    • getRunLast

      @Nullable public RMTextRun getRunLast()
      Returns the last run.
      Overrides:
      getRunLast in class RMTextRun
    • getRunsHeight

      public double getRunsHeight()
      Returns the total height of line runs.
    • getMaxAscent

      public double getMaxAscent()
      Returns the max ascent of the chars in this line.
    • getLineAdvance

      public double getLineAdvance()
      Returns the vertical distance for any line below this line.
    • getXForChar

      public double getXForChar(int anIndex)
      Returns the x coord for the given character index.
      Overrides:
      getXForChar in class RMTextRun
    • getPointForChar

      public Point2D getPointForChar(int anIndex)
      Returns the text origin for the given character index.
      Overrides:
      getPointForChar in class RMTextRun
    • getRunForPointX

      @Nullable public RMTextRun getRunForPointX(double anX)
      Returns the line index for the given y value.
    • getCharIndex

      public int getCharIndex(double anX)
      Returns the character index for the given x/y point.
      Overrides:
      getCharIndex in class RMTextRun
    • getUnderlineStroke

      public double getUnderlineStroke()
      Returns the max stroke width of any underlined chars in this line.
      Overrides:
      getUnderlineStroke in class RMTextRun
    • getUnderlineY

      public double getUnderlineY()
      Returns the Y position of any underlined chars in this line.
      Overrides:
      getUnderlineY in class RMTextRun
    • deleteFromLastWord

      protected int deleteFromLastWord(CharSequence anInput, int aStart)
      Rewind last word from line.
    • setLocked

      public void setLocked(boolean aFlag)
      Sets whether text layout can add more characters.
      Overrides:
      setLocked in class RMTextRun
    • performTabShift

      public void performTabShift()
      If line has any non-left tabs this method adjusts the width of the tab runs (and the positions of successive runs to correct for shift of these tabs).
    • performAlignment

      protected void performAlignment()
      Performs alignment.
    • toString

      public String toString()
      Standard toString implementation.
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class RMTextRun