Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
This is related to JDK-8092278 and JDK-8130362, but asks for much less. While those tickets ask for selection/cut/copy/paste functionality to be implemented by TextFlow, here I want to ask to only expose low-level methods to obtain the selection/caret shape (for a given range/position). This is all it takes to implement those methods in TextFlow.java (see also the attached patch against 9-dev): public PathElement[] getCaretShape(int charIdx, boolean isLeading) { return getTextLayout().getCaretShape(charIdx, isLeading, 0.0f, 0.0f); } public PathElement[] getSelectionShape(int from, int to) { return getTextLayout().getRange(from, to, TextLayout.TYPE_TEXT, 0, 0); } This, together with a hit-test API (JDK-8090357, JDK-8091012) allows users to implement such higher level functionality as selection, copy&paste, editing... I have implemented the equivalents of the above methods in RichTextFX using reflection and com.sun.javafx.scene.text.TextLayout, and implemented selection and editing on top of them. This request is prompted by the fact that starting with JDK 9, com.sun.* APIs will not be accessible. My hope is that this could be targeted for 9.
|