*/
public Shape[] getCaretShapes(
int offset, Rectangle2D bounds,
TextLayout.CaretPolicy policy, TextLayout layout
) {
TextHitInfo hit1 = TextHitInfo.afterOffset(offset);
TextHitInfo hit2 = getVisualOtherHit(hit1);
Shape caret1 = getCaretShape(hit1, layout);
if (getVisualFromHitInfo(hit1) == getVisualFromHitInfo(hit2)) {
return new Shape[] {caret1, null};
}
Shape caret2 = getCaretShape(hit2, layout);
TextHitInfo strongHit = policy.getStrongCaret(hit1, hit2, layout);
return strongHit.equals(hit1) ?
new Shape[] {caret1, caret2} :
new Shape[] {caret2, caret1};
}