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 TypeMethodDescriptionvoid
Draws this frame onto the givencanvas
using the givenrenderer
.generateSelectionPath
(int charStart, int charEnd) Generates a path that contains a set of rectangles covering the specified selection range.int
Returns the index after the last character of this frame in source text.int
Returns the index to the first character of this frame in source text.float
Returns the height of this frame.int
getLineIndexForChar
(int charIndex) Returns the index of line containing the specified character.int
getLineIndexForPosition
(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.float
Returns the x- origin of this frame.float
Returns the y- origin of this frame.float
getWidth()
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
- ifcharIndex
is 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
- ifcharStart
is less than frame start, orcharEnd
is greater than frame end, orcharStart
is greater thancharEnd
.
-
draw
Draws this frame onto the givencanvas
using 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
-