Other |
---|
tbdResolved |
Cloners :
|
|
Duplicate :
|
The RichTextArea control (JDK-8301121), or any custom control that need to render custom text decorations (such as selection blocks, squiggly lines, strike-through lines, to name a few) can benefit from a better public API representing the range. Currently, the range is represented by an array of PathElements in an undocumented fashion; the reverse engineering shows that it is typically a sequence of [MoveTo,LineTo] for single lines, or [MoveTo,LineTo,LineTo,LineTo, LineTo] for blocks. One possibility is to add a new method to Text / TextFlow: public RangeInfo getRangeInfo(int start, int end, RangeType type) or possibly public RangeInfo getRangeInfo(int start, int end, RangeType type, boolean includeLineSpacing) to address JDK-8317120 RFE: TextFlow.rangeShape() ignores lineSpacing JDK-8317122 RFE: TextFlow.preferredHeight ignores lineSpacing The RangeInfo class would provide the following data points: - PathElement[] getRangeShape() // to be used by the legacy rangeShape() method - PathElement[] getUnderlineShape() // to be used by the legacy underlineShape() method - PathElement[] getStrikeThroughShape() - getPartCount // the number of "parts", i.e. lines or rectangular blocks - getBounds(int part) // the bounds of each part The RichTextArea requires such a public API in TextFlow only, but we'll basically get the same functionality for Text node for free. NOTE: this API is somewhat derivative of JDK-8341670 [Text,TextFlow] Public API for Text Layout, it might be possible to roll the requested functionality into LayoutInfo class.