Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8341670

[Text,TextFlow] Public API for Text Layout Info

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • javafx
    • None
    • Fix Understood

      The RichTextArea control (JDK-8301121), or any custom control that needs non-trivial navigation within complex or wrapped text needs a public API to get information about various aspects of the text layout.

      One possibility is to add a new method to Text / TextFlow:
        public LayoutInfo getLayoutInfo()

      Where LayoutInfo structure provides methods for querying the following information:

      - text lines: offsets and bounds
      - overall layout bounds
      - text selection geometry (JDK-8341672)
      - strike-through geometry (JDK-8341672)
      - underline geometry (JDK-8341672)

      The line bounds obtained via LayoutInfo might help address JDK-8091012 "[Text] No way to distinguish between a hit to the last character and a hit beyond the end of text", albeit indirectly.

      The RichTextArea requires such a public API in TextFlow only, but we'll basically get the same functionality for Text node for free.

      See also
      https://github.com/andy-goryachev-oracle/Test/blob/main/doc/Text/LayoutInfo.md

            angorya Andy Goryachev
            angorya Andy Goryachev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: