Use getRunAdvance to position cursor

TextLine used to use getTextRunAdvances on a substring to compute a
cursor position, but this had a number of problems, especially when
the substring is a wider than the full string (as can happen in
certain Tamil ligatures).

This patch changes the implementation to use getRunAdvance, which was
explicitly designed for this use case.

We should also change Layout.getHorizontal to use the dual
getOffsetForAdvance, but that's basically a performance optimization,
the functionality should be basically equivalent.

Bug: 21125816
Change-Id: I669b85eaecfbf6f7aa6c6a9dddbf1a210eb94571
2 files changed