if (!advancing || offsetInLine == 0) { point = layout.getLocation(offsetInLine, false); } else { point = layout.getLocation(offsetInLine - 1, true);
switch (caretAlignment) { case OFFSET_LEADING: point = layout.getLocation(offsetInLine, false); break; case PREVIOUS_OFFSET_TRAILING: default: if (offsetInLine == 0) { point = layout.getLocation(offsetInLine, false); } else { point = layout.getLocation(offsetInLine - 1, true); } break;
Point getPointAtOffset(int offset) {	int lineIndex = content.getLineAtOffset(offset);	String line = content.getLine(lineIndex);	int lineOffset = content.getOffsetAtLine(lineIndex);	int offsetInLine = offset - lineOffset;	int lineLength = line.length();	if (lineIndex < content.getLineCount() - 1) {		int endLineOffset = content.getOffsetAtLine(lineIndex + 1) - 1;		if (lineLength < offsetInLine && offsetInLine <= endLineOffset) {			offsetInLine = lineLength;		}	}	Point point;	if (lineLength != 0  && offsetInLine <= lineLength) {		TextLayout layout = renderer.getTextLayout(lineIndex);		if (!advancing || offsetInLine == 0) {			point = layout.getLocation(offsetInLine, false);		} else {			point = layout.getLocation(offsetInLine - 1, true);		}		renderer.disposeTextLayout(layout);	} else {		point = new Point(0, 0);	}	point.x += leftMargin - horizontalScrollOffset;	point.y += getLinePixel(lineIndex);	return point;}