Class RMTextLine

  • All Implemented Interfaces:
    java.awt.Shape, java.io.Serializable, java.lang.CharSequence, java.lang.Cloneable

    public class RMTextLine
    extends RMTextRun
    A class to represent a line of text in a layout.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D

        java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
    • Field Summary

      • Fields inherited from class java.awt.geom.Rectangle2D.Double

        height, width, x, y
      • Fields inherited from class java.awt.geom.Rectangle2D

        OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
    • Constructor Summary

      Constructors 
      Constructor Description
      RMTextLine()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addChar​(char aChar, double aWidth)
      Adds a char to text line.
      int addChars​(RMXStringRun aRun, int aStart, int anEnd)
      Adds chars to text line.
      char charAt​(int anIndex)
      Returns the char value at the specified index.
      protected int deleteFromLastWord​(java.lang.CharSequence anInput, int aStart)
      Rewind last word from line.
      int getCharIndex​(double anX)
      Returns the character index for the given x/y point.
      double getHitMaxX()
      Returns the max x position possible for layout's path.
      double getLineAdvance()
      Returns the vertical distance for any line below this line.
      double getMaxAscent()
      Returns the max ascent of the chars in this line.
      RMTextLine getNext()
      Returns the next run.
      java.awt.geom.Point2D getPointForChar​(int anIndex)
      Returns the text origin for the given character index.
      RMTextRun getRun​(int anIndex)
      Returns the text run at the given index.
      int getRunCount()
      Returns the number of runs in this line.
      RMTextRun getRunForPointX​(double anX)
      Returns the line index for the given y value.
      RMTextRun getRunLast()
      Returns the last run.
      double getRunsHeight()
      Returns the total height of line runs.
      double getUnderlineStroke()
      Returns the max stroke width of any underlined chars in this line.
      double getUnderlineY()
      Returns the Y position of any underlined chars in this line.
      double getXForChar​(int anIndex)
      Returns the x coord for the given character index.
      double getYBaseline()
      Returns the y position for this line (in same coords as the layout frame).
      protected void performAlignment()
      Performs alignment.
      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).
      protected void setBounds​(double anX, double aY, double aWidth, double aHeight)
      Sets the bounds of this layout.
      void setLocked​(boolean aFlag)
      Sets whether text layout can add more characters.
      java.lang.CharSequence subSequence​(int aStart, int anEnd)
      Returns a new char sequence that is a subsequence of this sequence.
      java.lang.String toString()
      Standard toString implementation.
      • Methods inherited from class java.awt.geom.Rectangle2D.Double

        createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect
      • Methods inherited from class java.awt.geom.Rectangle2D

        add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
      • Methods inherited from class java.awt.geom.RectangularShape

        clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.CharSequence

        chars, codePoints
    • Constructor Detail

      • RMTextLine

        public RMTextLine()
    • Method Detail

      • 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 java.lang.CharSequence
        Overrides:
        charAt in class RMTextRun
      • subSequence

        public java.lang.CharSequence subSequence​(int aStart,
                                                  int anEnd)
        Returns a new char sequence that is a subsequence of this sequence.
        Specified by:
        subSequence in interface java.lang.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.
      • 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
      • 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 java.awt.geom.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​(java.lang.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 java.lang.String toString()
        Standard toString implementation.
        Specified by:
        toString in interface java.lang.CharSequence
        Overrides:
        toString in class RMTextRun