Package com.mta.tehreer.layout
Class ComposedFrame
java.lang.Object
com.mta.tehreer.layout.ComposedFrame
Represents a frame containing multiple lines of text. The frame object is the output resulting
from text-framing process performed by a typesetter object.
-
Method Summary
Modifier and TypeMethodDescriptionvoidDraws this frame onto the givencanvasusing the givenrenderer.generateSelectionPath(int charStart, int charEnd) Generates a path that contains a set of rectangles covering the specified selection range.intReturns the index after the last character of this frame in source text.intReturns the index to the first character of this frame in source text.floatReturns the height of this frame.intgetLineIndexForChar(int charIndex) Returns the index of line containing the specified character.intgetLineIndexForPosition(float x, float y) Returns the index of a suitable line representing the specified position.getLines()Returns an unmodifiable list that contains all the lines of this frame.floatReturns the x- origin of this frame.floatReturns the y- origin of this frame.floatgetWidth()Returns the width of this frame.toString()
-
Method Details
-
getCharStart
public int getCharStart()Returns the index to the first character of this frame in source text.- Returns:
- The index to the first character of this frame in source text.
-
getCharEnd
public int getCharEnd()Returns the index after the last character of this frame in source text.- Returns:
- The index after the last character of this frame in source text.
-
getOriginX
public float getOriginX()Returns the x- origin of this frame.- Returns:
- The x- origin of this frame.
-
getOriginY
public float getOriginY()Returns the y- origin of this frame.- Returns:
- The y- origin of this frame.
-
getWidth
public float getWidth()Returns the width of this frame.- Returns:
- The width of this frame.
-
getHeight
public float getHeight()Returns the height of this frame.- Returns:
- The height of this frame.
-
getLines
Returns an unmodifiable list that contains all the lines of this frame.- Returns:
- An unmodifiable list that contains all the lines of this frame.
-
getLineIndexForChar
public int getLineIndexForChar(int charIndex) Returns the index of line containing the specified character.- Parameters:
charIndex- The index of character for which to return the line index.- Returns:
- The index of line containing the specified character.
- Throws:
IllegalArgumentException- ifcharIndexis less than frame start or greater than frame end.
-
getLineIndexForPosition
public int getLineIndexForPosition(float x, float y) Returns the index of a suitable line representing the specified position.- Parameters:
x- The x- coordinate of position.y- The y- coordinate of position.- Returns:
- The index of a suitable line representing the specified position.
-
generateSelectionPath
Generates a path that contains a set of rectangles covering the specified selection range.- Parameters:
charStart- The index to the first character of selection in source text.charEnd- The index after the first character of selection in source text.- Returns:
- A path that contains a set of rectangles covering the specified selection range.
- Throws:
IllegalArgumentException- ifcharStartis less than frame start, orcharEndis greater than frame end, orcharStartis greater thancharEnd.
-
draw
Draws this frame onto the givencanvasusing the givenrenderer.- Parameters:
renderer- The renderer to use for drawing this frame.canvas- The canvas onto which to draw this frame.x- The x- position at which to draw this frame.y- The y- position at which to draw this frame.
-
toString
-