// Doesn't fit?
if (remainingWidth < 0f)
{
// Can't start a new line
if (lineIsEmpty || lineCount == maxLineCount)
{
// This is the first word on the line -- add it up to the character that fits
sb.Append(text.Substring(start, Mathf.Max(0, offset - start)));
if (lineCount++ == maxLineCount)
{
start = offset;
break;
}
//============================ START MODIFICATION =================================
if (ch == ' ')
{
if (keepCharCount) ReplaceSpaceWithNewline(ref sb);
else EndLine(ref sb);
lineIsEmpty = true;
start = offset + 1;
remainingWidth = rectWidth;
}
else
{
if (start < offset) sb.Append(text.Substring(start, offset - start));
finalText = sb.ToString();
return false;
}
//============================ END MODIFICATION =================================
prev = 0;
}
........................................
......... skipping over ...........
........................................
if (start < offset) sb.Append(text.Substring(start, offset - start));
finalText = sb.ToString();
//============================ START MODIFICATION =================================
if (remainingWidth < 0) return false;
//============================ END MODIFICATION =================================
return (offset == textLength) || (lineCount <= Mathf.Min(maxLines, maxLineCount));
}