}
renderLines(w, r, textLines);
}
private void renderLines(final Element w, final NiftyRenderEngine r, String[] lines) {
RenderFont font = ensureFont(r);
boolean stateSaved = prepareRenderEngine(r, font);
int y = getStartYWithVerticalAlign(lines.length * font.getHeight(), w.getHeight(), textVAlign);
for (String line : lines) {
int yy = w.getY() + y;
if (Math.abs(xoffsetHack) > 0) {
int fittingOffset = FontHelper.getVisibleCharactersFromStart(font, line, Math.abs(xoffsetHack), 1.0f);
String cut = line.substring(0, fittingOffset);
String substring = line.substring(fittingOffset, line.length());
int xx = w.getX() + xoffsetHack + font.getWidth(cut);
renderLine(xx, yy, substring, r, selectionStart - fittingOffset, selectionEnd - fittingOffset);
} else {
int xx = w.getX() + getStartXWithHorizontalAlign(font.getWidth(line), w.getWidth(), textHAlign);
renderLine(xx, yy, line, r, selectionStart, selectionEnd);
}
y += font.getHeight();
}
restoreRenderEngine(r, stateSaved);
}