lastOffset = end;
lastOffset = Math.max(lastOffset, end);
TextLayout getTextLayout(String line, int lineOffset) {	TextLayout layout = createTextLayout(lineOffset);	layout.setFont(regularFont);	layout.setAscent(ascent);	layout.setDescent(descent);	layout.setText(line);	layout.setOrientation(getOrientation());	layout.setSegments(getBidiSegments(lineOffset, line));	layout.setTabs(new int[]{tabWidth});	int length = line.length();	StyledTextEvent event = getLineStyleData(lineOffset, line);	StyleRange[] styles = event != null ? event.styles : null;	int lastOffset = 0;	if (styles != null) {		for (int styleIndex = 0; styleIndex < styles.length; styleIndex++) {			StyleRange style = styles[styleIndex];			if (style.isUnstyled()) continue;			int start, end;			if (lineOffset > style.start) {				start = 0;				end = Math.min (length, style.length - lineOffset + style.start);			} else {				start = style.start - lineOffset;				end = Math.min(length, start + style.length);			}			if (start >= length) break;			if (lastOffset != start) {				layout.setStyle(null, lastOffset, start - 1);				}			TextStyle textStyle = new TextStyle(getFont(style.fontStyle), style.foreground, style.background);			layout.setStyle(textStyle, start, end - 1);			lastOffset = end;		}	}	if (lastOffset != length) layout.setStyle(null, lastOffset, length);	return layout;}