import javafx.application.*; import javafx.geometry.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.shape.*; import javafx.scene.text.*; import javafx.stage.*; import com.sun.javafx.scene.text.HitInfo; public class RT34474 extends Application { public static void main(String[] args) { launch(args); } static final String bidiStr = "abc \u05e4\u05d9\u05d2\u05de\u05ea def"; public void start(Stage stage) { Text text = new Text(bidiStr); text.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT); moveleftFrom(text, 6); moveleftFrom(text, 7); moveleftFrom(text, 8); Group pane = new Group(); TextField textfield = new TextField(bidiStr); pane.getChildren().addAll(textfield); Scene scene = new Scene(pane, 200, 100); scene.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT); stage.setScene(scene); stage.show(); } void moveleftFrom(Text text, int pos) { text.setImpl_caretBias(false); text.setImpl_caretPosition(pos); Path caretPath = new Path(); caretPath.getElements().addAll(text.getImpl_caretShape()); Bounds caretBounds = caretPath.getLayoutBounds(); double hitX = caretBounds.getMaxX(); double hitY = (caretBounds.getMinY() + caretBounds.getMaxY()) / 2; HitInfo hit = text.impl_hitTestChar(new Point2D(hitX, hitY)); System.out.println("Move left from pos="+pos+", hit = "+hit + ". "); } }