double (Graphics2D g, String s, double x, double y) { if (!myPrintSettings.PRINT_AS_GRAPHICS) { if (myPerformActualDrawing) { g.drawString(s, (float)x, (float)y); } return g.getFontMetrics().stringWidth(s); } else { GlyphVector v = g.getFont().createGlyphVector(g.getFontRenderContext(), s); if (myPerformActualDrawing) { g.translate(x, y); g.fill(v.getOutline()); g.translate(-x, -y); } return v.getLogicalBounds().getWidth(); } }