Graphics2D pie = pasteBackgroundAndSetTextColor(out, background);
Graphics2D g2 = pasteBackgroundAndSetTextColor(out, background); g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    public BufferedImage pasteText(final BufferedImage background,                                   final AttributedString attributedWord)    {        BufferedImage out = copyBackground(background);        Graphics2D pie = pasteBackgroundAndSetTextColor(out, background);        //set font to max in order to retrieve the correct boundaries        Font maxFont = getMaxFont(attributedWord.getIterator());        Rectangle2D bounds = getTextBoundaries(pie, maxFont, attributedWord);        int[] randomDeviation = getRandomDeviation(background, bounds, maxFont);        //draw the string        pie.drawString(attributedWord.getIterator(),                randomDeviation[0], randomDeviation[1]);        pie.dispose();        return out;    }