This request comes in two parts.
1. Provide a method in the Text class similar to java.lang.Character.offsetByCodePoints().
See http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#offsetByCodePoints%28java.lang.CharSequence,%20int,%20int%29
This could be:
public int offsetByCharCluster(int index, int clusterCount);
where clusterCount is the number of clusters to include after (or before if negative) the index. The clusterCount value will probably not be greater than 1 in most cases, but this is a simple way to also provide the direction.
Note that the method should include the functionality of offsetByCodePoints() and count surrogate character pairs as clusters as well.
2. Include cluster offset as part of the HitInfo object returned from a hit test. The method
HitInfo.getInsertionIndex() should then add that number instead of 1 when leading is false;
- blocks
-
JDK-8115439 TextField/TextArea: on Windows, for Thai text, caret goes back to the beginning when it meets "ำ" character.
- Closed
-
JDK-8120052 TextArea/TextField, caret issue for Thai characters.
- Closed
-
JDK-8102434 Support complex characters in controls
- Closed
- relates to
-
JDK-8090357 [Text] Make public API's for hit_test/selection
- Resolved
-
JDK-8136350 [TextFlow] Hit test API for TextFlow
- Resolved
-
JDK-8089924 TextField/TextArea: on Windows, it takes two strokes to move the caret over the some complex text cluster.
- Open
-
JDK-8300569 ☂ Missing APIs related to rich text control
- In Progress
-
JDK-8136971 Review the new TextPosInfo API
- Resolved
-
JDK-8309565 [Text] Enhance support for user-perceived characters (grapheme clusters)
- Open