Point2D p = new Point2D.Float(x, y);
try {
transform.inverseTransform(p, p);
} catch (java.awt.geom.NoninvertibleTransformException nite) {;}
TextHitInfo hit = layout.hitTestChar((float) p.getX(),
(float) p.getY());
// put this in to be consistent with GlyphLayout
if (hit.getCharIndex() == -1) {
return null;
}
aci.setIndex(hit.getCharIndex() + aci.getBeginIndex());
int charIndex = ((Integer)aci.getAttribute(
GVTAttributedCharacterIterator.TextAttribute.CHAR_INDEX)).intValue();
return new TextHit(charIndex, hit.isLeadingEdge());
}