Example #1
0
        // Input data in render text values
        Rect GetTextSpanRect(Rect lineRect, string renderText, int startPosition, int length)
        {
            if (startPosition < 0)
            {
                startPosition = 0;
            }
            if (startPosition >= renderText.Length - 1)
            {
                startPosition = renderText.Length - 1;
            }
            if (startPosition + length >= renderText.Length)
            {
                length = Mathf.Max(1, renderText.Length - startPosition);
            }

            var start = LineStyle.GetCursorPixelPosition(lineRect, MissingEngineAPI.GUIContent_Temp(renderText), startPosition);
            var end   = LineStyle.GetCursorPixelPosition(lineRect, MissingEngineAPI.GUIContent_Temp(renderText), startPosition + length);

            return(new Rect(start.x, start.y, end.x - start.x, LineHeight));
        }