RenderFont font = ensureFont(r);
List < String > lines = new ArrayList < String > ();
for (String line : textLines) {
int lineLengthInPixel = font.getWidth(line);
if (lineLengthInPixel > width) {
lines.addAll(new TextBreak(line, width, font).split());
} else {
lines.add(line);
}
}
return lines.toArray(new String[0]);