On Mon, 8 May 2023 12:22:17 GMT, Karthik P K <k...@openjdk.org> wrote:

>> Since surrogate pairs are internally considered as 2 characters and text 
>> field is null in `HitInfo` when `getInsertionIndex` is invoked from 
>> `TextFlow`, wrong insertion index was returned.
>> 
>> Updated code to calculate insertion index in `getHitInfo` method of 
>> `PrismTextLayout` class when `hitTest` of trailing side of surrogate pair is 
>> requested. Since text runs are processed in this method already, calculating 
>> the insertion index in this method looks better than calculating in 
>> `getInsertionIndex` of `HitInfo` method.
>> The latter approach also requires the text to be sent to `HitInfo` as 
>> parameter from the `hitTest` method of `TextFlow`. If the number of `Text` 
>> nodes in `TextFlow` are very large, processing all the `Text` nodes on each 
>> `hitTest` method invocation might cause performance issue. Hence implemented 
>> first approach.
>> 
>> Added system test to validate the fix.
>
> Karthik P K has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Fix insertion index calculation issue with emojis. Add additional test cases

Does not seem to work correctly still - the insertion index in TextFlow should 
not point in between surrogate pair of characters that comprise an emoji.  
Basically, it should be exactly the same as with Text.hitInfo():

![Screenshot 2023-05-08 at 09 29 
35](https://user-images.githubusercontent.com/107069028/236879369-f7634c6e-e5c8-41f4-8ded-dd59327de73b.png)

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1091#issuecomment-1538697285

Reply via email to