Vector2 GetCharLocation(TextField.CharPosition cp)
{
TextField.LineInfo line = textField.lines[cp.lineIndex];
Vector2 pos;
if (line.text.Length == 0 || textField.charPositions.Count == 0)
{
if (textField.align == AlignType.Center)
pos.x = (int)(_contentRect.width / 2);
else
pos.x = GUTTER_X;
}
else
{
TextField.CharPosition v = textField.charPositions[Math.Min(cp.caretIndex, textField.charPositions.Count - 1)];
pos.x = v.offsetX - 1;
}
pos.x += textField.x;
pos.y = textField.y + line.y;
return pos;
}