Platform SDK: International Features |
Conventionally, caret position (cp) may be selected by clicking either the trailing half of character "cp-1" or the leading half of character "cp". This may be implemented as follows:
int iCharPos; int iCaretPos int fTrailing; ScriptXtoCP(iMouseX, ..., &iCharPos, &fTrailing); iCaretPos = iCharPos + fTrailing;
For scripts that snap the caret to cluster boundaries, ScriptXtoCP returns ftrailing set to either 0 or the width of the cluster in code points.