Package com.reportmill.text
Class RMTextLine
- java.lang.Object
-
- com.reportmill.base.RMObject
-
- com.reportmill.text.RMTextLine
-
- All Implemented Interfaces:
RMArchiver.Archiving
,java.lang.Cloneable
public class RMTextLine extends RMObject
This class represents a line of characters in a text layout. It is made up of frags.
-
-
Constructor Summary
Constructors Constructor Description RMTextLine(RMTextLayout aLayout, RMTextLine aLastLine)
Creates an empty line object for a given layout.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RMTextFrag
addFrag()
Adds an empty frag to the line.char[]
chars()
Returns a char array of the chars in the line.void
fragAddEnd()
Called after we added frags.void
fragAddStart()
Called before we start adding frags.int
getCharForX(float x)
Returns the character index of the character at the given x position.int
getEnd()
Returns the end character index of the line.boolean
getEndsWithNewline()
Returns whether line ends with newline.RMTextFrag
getFrag(int anIndex)
Returns the text frag at the given index.int
getFragCount()
Returns the number of frags in this line.RMTextFrag
getFragLast()
Returns the last text frag of this line.float
getHeight()
Returns the max height of the chars in this line.float
getHeight(boolean includeGap)
Returns the max height of the chars in this line.float
getHitMaxX()
Returns the max x position possible for layout's path.float
getIndent()
Returns the indent for this line.int
getLastWordStart()
Returns the index of the last word break character in the line.RMTextLayout
getLayout()
Returns the layout that this line is associated with.float
getLeading()
Returns the max leading of the chars in this line.float
getMaxAscent()
Returns the max ascent of the chars in this line.float
getMaxDescent()
Returns the max descent of the chars in this line.float
getMaxX()
Returns the maxX position for this line (in same coords as the layout frame).float
getMaxY()
Returns the maxY position for this line (in same coords as the layout frame).float
getMaxY(boolean includeGap)
Returns the maxY position for this line (in same coords as the layout frame).float
getNextLineX()
Returns what this line thinks is the next line's x.int
getStart()
Returns the start character index of the line.float
getUnderlineStroke()
Returns the max stroke width of any underlined chars in this line.float
getUnderlineY()
Returns the Y position of any underlined chars in this line.float
getWidth()
Returns the width of this line of chars.float
getX()
Returns the x position for this line (in same coords as the layout frame).float
getY()
Returns the maxY position for this line (in same coords as the layout frame).float
getYBaseline()
Returns the y position for this line (in same coords as the layout frame).boolean
hasTab()
Returns whether line has a tab.boolean
isEmpty()
Returns whether line has nothing in it.void
lineAddEnd()
void
performTabShift()
If line has any non-left tabs this method adjusts the width of the tab frags (and the positions of successive frags to correct for shift of these tabs).void
reset()
Resets the line ivars (so that it can be reused).void
strip(int start)
Strips all characters after the given index from this line.java.lang.String
toString()
Returns the line as a string.-
Methods inherited from class com.reportmill.base.RMObject
clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, initWithArchiver, undoClone, undoCopy, undoEquals
-
-
-
-
Constructor Detail
-
RMTextLine
public RMTextLine(RMTextLayout aLayout, RMTextLine aLastLine)
Creates an empty line object for a given layout.
-
-
Method Detail
-
getLayout
public RMTextLayout getLayout()
Returns the layout that this line is associated with.
-
getStart
public int getStart()
Returns the start character index of the line.
-
getEnd
public int getEnd()
Returns the end character index of the line.
-
isEmpty
public boolean isEmpty()
Returns whether line has nothing in it.
-
getX
public float getX()
Returns the x position for this line (in same coords as the layout frame).
-
getY
public float getY()
Returns the maxY position for this line (in same coords as the layout frame).
-
getWidth
public float getWidth()
Returns the width of this line of chars.
-
getHeight
public float getHeight()
Returns the max height of the chars in this line.
-
getHeight
public float getHeight(boolean includeGap)
Returns the max height of the chars in this line.
-
getYBaseline
public float getYBaseline()
Returns the y position for this line (in same coords as the layout frame).
-
getMaxX
public float getMaxX()
Returns the maxX position for this line (in same coords as the layout frame).
-
getMaxY
public float getMaxY()
Returns the maxY position for this line (in same coords as the layout frame).
-
getMaxY
public float getMaxY(boolean includeGap)
Returns the maxY position for this line (in same coords as the layout frame).
-
getHitMaxX
public float getHitMaxX()
Returns the max x position possible for layout's path.
-
getNextLineX
public float getNextLineX()
Returns what this line thinks is the next line's x.
-
getMaxAscent
public float getMaxAscent()
Returns the max ascent of the chars in this line.
-
getMaxDescent
public float getMaxDescent()
Returns the max descent of the chars in this line.
-
getLeading
public float getLeading()
Returns the max leading of the chars in this line.
-
getIndent
public float getIndent()
Returns the indent for this line.
-
getUnderlineStroke
public float getUnderlineStroke()
Returns the max stroke width of any underlined chars in this line.
-
getUnderlineY
public float getUnderlineY()
Returns the Y position of any underlined chars in this line.
-
getLastWordStart
public int getLastWordStart()
Returns the index of the last word break character in the line.
-
strip
public void strip(int start)
Strips all characters after the given index from this line.
-
getCharForX
public int getCharForX(float x)
Returns the character index of the character at the given x position.
-
getFragCount
public int getFragCount()
Returns the number of frags in this line.
-
getFrag
public RMTextFrag getFrag(int anIndex)
Returns the text frag at the given index.
-
getFragLast
public RMTextFrag getFragLast()
Returns the last text frag of this line.
-
addFrag
public RMTextFrag addFrag()
Adds an empty frag to the line.
-
getEndsWithNewline
public boolean getEndsWithNewline()
Returns whether line ends with newline.
-
hasTab
public boolean hasTab()
Returns whether line has a tab.
-
performTabShift
public void performTabShift()
If line has any non-left tabs this method adjusts the width of the tab frags (and the positions of successive frags to correct for shift of these tabs).
-
fragAddStart
public void fragAddStart()
Called before we start adding frags.
-
fragAddEnd
public void fragAddEnd()
Called after we added frags.
-
lineAddEnd
public void lineAddEnd()
-
reset
public void reset()
Resets the line ivars (so that it can be reused).
-
chars
public char[] chars()
Returns a char array of the chars in the line.
-
toString
public java.lang.String toString()
Returns the line as a string.- Overrides:
toString
in classjava.lang.Object
-
-