Class LayoutInfo
java.lang.Object
javafx.scene.text.LayoutInfo
Holds a snapshot of the text layout geometry in a
Text or a TextFlow node,
such as break up of the text into lines, as well as other shapes derived from the layout
(selection, underline, etc.).
The information in this object is valid until the next layout cycle.
- Since:
- 25
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract CaretInfocaretInfoAt(int charIndex, boolean leading) Returns the information related to the caret at the specified character index and the character bias.abstract Rectangle2DgetLogicalBounds(boolean includeLineSpacing) Returns the logical bounds of the layout.abstract List<Rectangle2D> getSelectionGeometry(int start, int end, boolean includeLineSpacing) Returns the geometry of the text selection, as an immutable list ofRectangle2Dobjects, for the given start and end offsets.abstract List<Rectangle2D> getStrikeThroughGeometry(int start, int end) Returns the geometry of the strike-through shape, as an immutable list ofRectangle2Dobjects, for the given start and end offsets.abstract TextLineInfogetTextLine(int index, boolean includeLineSpacing) Returns theTextLineInfoobject which contains information about the text line at indexindex.abstract intReturns the number of text lines in the layout.abstract List<TextLineInfo> getTextLines(boolean includeLineSpacing) Returns the immutable list of text lines in the layout.abstract List<Rectangle2D> getUnderlineGeometry(int start, int end) Returns the geometry of the underline shape, as an immutable list ofRectangle2Dobjects, for the given start and end offsets.
-
Constructor Details
-
LayoutInfo
protected LayoutInfo()Constructor for subclasses to call.
-
-
Method Details
-
getLogicalBounds
Returns the logical bounds of the layout. Depending onincludeLineSpacing, the return value may include the line spacing after the last line of text.- Parameters:
includeLineSpacing- determines whether the line spacing after last text line should be included- Returns:
- the layout bounds
-
getTextLineCount
public abstract int getTextLineCount()Returns the number of text lines in the layout.- Returns:
- the number of text lines
-
getTextLines
Returns the immutable list of text lines in the layout.- Parameters:
includeLineSpacing- determines whether the result includes the line spacing- Returns:
- the immutable list of
TextLineInfoobjects
-
getTextLine
Returns theTextLineInfoobject which contains information about the text line at indexindex.- Parameters:
index- the line indexincludeLineSpacing- determines whether the result includes the line spacing- Returns:
- the
TextLineInfoobject - Throws:
IndexOutOfBoundsException- if the index is out of range(index < 0 || index >= getTextLineCount())
-
getSelectionGeometry
public abstract List<Rectangle2D> getSelectionGeometry(int start, int end, boolean includeLineSpacing) Returns the geometry of the text selection, as an immutable list ofRectangle2Dobjects, for the given start and end offsets.- Parameters:
start- the start offsetend- the end offsetincludeLineSpacing- determines whether the result includes the line spacing- Returns:
- the immutable list of
Rectangle2Dobjects
-
getStrikeThroughGeometry
Returns the geometry of the strike-through shape, as an immutable list ofRectangle2Dobjects, for the given start and end offsets.- Parameters:
start- the start offsetend- the end offset- Returns:
- the immutable list of
Rectangle2Dobjects
-
getUnderlineGeometry
Returns the geometry of the underline shape, as an immutable list ofRectangle2Dobjects, for the given start and end offsets.- Parameters:
start- the start offsetend- the end offset- Returns:
- the immutable list of
Rectangle2Dobjects
-
caretInfoAt
Returns the information related to the caret at the specified character index and the character bias.- Parameters:
charIndex- the character indexleading- whether the caret is biased on the leading edge of the character- Returns:
- the
CaretInfoobject
-