class AbstractAWTDrawVisitor implements IDrawVisitor {

    protected Point getTextBasePoint(String text, double xCoord, double yCoord, Graphics2D graphics) {
        FontMetrics fontMetrics = graphics.getFontMetrics();
        Rectangle2D stringBounds = fontMetrics.getStringBounds(text, graphics);
        int[] point = this.transformPoint(xCoord, yCoord);
        int baseX = (int) (point[0] - (stringBounds.getWidth() / 2));

        // correct the baseline by the ascent
        int baseY = (int) (point[1] + (fontMetrics.getAscent() - stringBounds.getHeight() / 2));
        return new Point(baseX, baseY);
    }

}