Fix measurement to respect grapheme and span boundaries

When measuring in TextLine (important for cursor positioning), the
substring measured must neither be too short (it can't just be the
substring up to the measure limit, but must include additional
characters if they form a ligature) nor too long (it can't extend
beyond the end of the CharacterStyle span, otherwise the measurement
fails to account for the fact that the CharacterStyle span boundary
breaks the ligature). This patch gets it just right.

Bug: 25375561
Change-Id: I36e1c4bdc66424d3b611cf54031756cf54cf3fec
1 file changed