Пример #1
0
        public Vector2 GetCursorPosition(CursorPositionStylePainterParameters painterParams)
        {
            Font font = painterParams.font;

            if (font == null)
            {
                Debug.LogError("StylePainter: Can't process a null font.");
                return(Vector2.zero);
            }

            string     text          = painterParams.text;
            int        fontSize      = painterParams.fontSize;
            FontStyle  fontStyle     = painterParams.fontStyle;
            TextAnchor anchor        = painterParams.anchor;
            float      wordWrapWidth = painterParams.wordWrapWidth;
            bool       richText      = painterParams.richText;
            Rect       rect          = painterParams.rect;
            int        cursorIndex   = painterParams.cursorIndex;

            return(GetCursorPosition(text, font, fontSize, fontStyle, anchor, wordWrapWidth, richText, rect, cursorIndex));
        }
Пример #2
0
        public Vector2 GetCursorPosition(CursorPositionStylePainterParameters painterParams)
        {
            Font    font = painterParams.font;
            Vector2 result;

            if (font == null)
            {
                Debug.LogError("StylePainter: Can't process a null font.");
                result = Vector2.zero;
            }
            else
            {
                string     text          = painterParams.text;
                int        fontSize      = painterParams.fontSize;
                FontStyle  fontStyle     = painterParams.fontStyle;
                TextAnchor anchor        = painterParams.anchor;
                float      wordWrapWidth = painterParams.wordWrapWidth;
                bool       richText      = painterParams.richText;
                Rect       layout        = painterParams.layout;
                int        cursorIndex   = painterParams.cursorIndex;
                result = this.GetCursorPosition_Internal(text, font, fontSize, fontStyle, anchor, wordWrapWidth, richText, layout, cursorIndex);
            }
            return(result);
        }