if(wrappingWidth < 0) wrappingWidth = 1;
int nextBreak = text.indexOf('\n', startIndex + 1);
if(nextBreak == -1) nextBreak = it.getEndIndex();
TextLayout layout = measurer.nextLayout((float)wrappingWidth, nextBreak, true);
if (layout == null) {
// layout can be null if the entire word at the current position
// does not fit within the wrapping width. Try with requireNextWord=false.
layout = measurer.nextLayout((float)wrappingWidth, nextBreak, false);
}