Thanks. I don't think I want to make changes in this hairy code, but unfortunately the canvas Text Metrics implementation of caretPositionFromPoint will differ from the DOM version because it will be finding the text run (after bidi algorithm) then taking CaretPositionForHitTest. So no bidi adjustment.
If I was going to change anything, for hit testing (also mouse/touch selection) I would only do bidi adjustment if the hit point was very close to the boundary between two characters, not always when the offset returned is at a bidi boundary. I think that info is available.
Cheers,
Stephen.