FairyGUI.InputTextField.GetCharLocation C# (CSharp) Method

GetCharLocation() private method

获得字符的坐标。这个坐标是容器的坐标,不是文本里的坐标。
private GetCharLocation ( TextField cp ) : Vector2
cp TextField
return Vector2
        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;
        }