# Class LayoutInfo

java.lang.Object
javafx.scene.text.LayoutInfo

public abstract sealed class LayoutInfo extends Object
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
  Modifier
  Constructor
  Description
  `protected`
  `LayoutInfo()`
  Constructor for subclasses to call.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract CaretInfo`
  `caretInfoAt(int charIndex, boolean leading)`
  Returns the information related to the caret at the specified character index and the character bias.
  `abstract Rectangle2D`
  `getLogicalBounds(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 of `Rectangle2D` objects, 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 of `Rectangle2D` objects, for the given start and end offsets.
  `abstract TextLineInfo`
  `getTextLine(int index, boolean includeLineSpacing)`
  Returns the `TextLineInfo` object which contains information about the text line at index `index`.
  `abstract int`
  `getTextLineCount()`
  Returns 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 of `Rectangle2D` objects, for the given start and end offsets.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LayoutInfo

    protected LayoutInfo()
    Constructor for subclasses to call.

- ## Method Details

  - ### getLogicalBounds

    public abstract Rectangle2D getLogicalBounds(boolean includeLineSpacing)
    Returns the logical bounds of the layout. Depending on `includeLineSpacing`, 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

    public abstract List<TextLineInfo> getTextLines(boolean includeLineSpacing)
    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 `TextLineInfo` objects

  - ### getTextLine

    public abstract TextLineInfo getTextLine(int index, boolean includeLineSpacing)
    Returns the `TextLineInfo` object which contains information about the text line at index `index`.
    Parameters:
      `index` - the line index
      `includeLineSpacing` - determines whether the result includes the line spacing
    Returns:
      the `TextLineInfo` object
    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 of `Rectangle2D` objects, for the given start and end offsets.
    Parameters:
      `start` - the start offset
      `end` - the end offset
      `includeLineSpacing` - determines whether the result includes the line spacing
    Returns:
      the immutable list of `Rectangle2D` objects

  - ### getStrikeThroughGeometry

    public abstract List<Rectangle2D> getStrikeThroughGeometry(int start, int end)
    Returns the geometry of the strike-through shape, as an immutable list of `Rectangle2D` objects, for the given start and end offsets.
    Parameters:
      `start` - the start offset
      `end` - the end offset
    Returns:
      the immutable list of `Rectangle2D` objects

  - ### getUnderlineGeometry

    public abstract List<Rectangle2D> getUnderlineGeometry(int start, int end)
    Returns the geometry of the underline shape, as an immutable list of `Rectangle2D` objects, for the given start and end offsets.
    Parameters:
      `start` - the start offset
      `end` - the end offset
    Returns:
      the immutable list of `Rectangle2D` objects

  - ### caretInfoAt

    public abstract CaretInfo caretInfoAt(int charIndex, boolean leading)
    Returns the information related to the caret at the specified character index and the character bias.
    Parameters:
      `charIndex` - the character index
      `leading` - whether the caret is biased on the leading edge of the character
    Returns:
      the `CaretInfo` object