x = x - leftMargin + horizontalScrollOffset; y = y - topMargin - getLinePixel(lineIndex);
x += horizontalScrollOffset - leftMargin; y -= getLinePixel(lineIndex);
int getOffsetAtPoint(int x, int y) {	int lineIndex = getLineIndex(y);	String line = content.getLine(lineIndex);	int lineOffset = content.getOffsetAtLine(lineIndex);	TextLayout layout = renderer.getTextLayout(line, lineOffset);	x = x - leftMargin + horizontalScrollOffset;	y = y - topMargin - getLinePixel(lineIndex);	int[] trailing = new int[1];	int offsetInLine = layout.getOffset(x, y, trailing);	advancing = false;	if (trailing[0] != 0) {		int lineLength = line.length();		if (offsetInLine + trailing[0] >= lineLength) {			offsetInLine = lineLength;			advancing = true;		} else {			int level;			int offset = offsetInLine;			while (offset > 0 && Character.isDigit(line.charAt(offset))) offset--;			if (offset == 0 && Character.isDigit(line.charAt(offset))) {				level = isMirrored() ? 1 : 0;			} else {				level = layout.getLevel(offset) & 0x1;			}			offsetInLine += trailing[0];			int trailingLevel = layout.getLevel(offsetInLine) & 0x1;			advancing  = (level ^ trailingLevel) != 0;		}	}	renderer.disposeTextLayout(layout);	return offsetInLine + lineOffset;}