boolean cleanSplit = true;
<BUG>List<Integer> indexes = getWrapableIndexes(shortenedText);
int start = 0;</BUG>
int j = indexes.size() - 1;
int end = indexes.get(j);
<BUG>int lineBreakPos = shortenedText.indexOf(10);
if (lineBreakPos != -1 && getTextWidth(font, fontSize, shortenedText.substring(start, lineBreakPos)) <= allowedWidth) {
end = lineBreakPos;</BUG>
} else {
<BUG>while (getTextWidth(font, fontSize, shortenedText.substring(start, end)) > allowedWidth) {
if (j == 0) {</BUG>
cleanSplit = false;

boolean cleanSplit = true;
List<Integer> indexes = getWrapableIndexes(text);
int start = 0;
int j = indexes.size() - 1;
int end = indexes.get(j);
int lineBreakPos = text.indexOf(10);
if (lineBreakPos != -1 && getTextWidth(font, fontSize, text.substring(start, lineBreakPos)) <= allowedWidth) {
end = lineBreakPos;
} else {
while (getTextWidth(font, fontSize, text.substring(start, end)) > allowedWidth) {
if (j == 0) {
cleanSplit = false;
