/** * Compute the cumulative height occupied by the text * * @param oldGraphics the graphics context, which properties are to be copied, may be null * @return the height in points */ public double getTextHeight(Graphics2D oldGraphics) { // dry-run in a 1x1 image and return the vertical advance BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); if (oldGraphics != null) { graphics.addRenderingHints(oldGraphics.getRenderingHints()); graphics.setTransform(oldGraphics.getTransform()); } DrawFactory.getInstance(graphics).fixFonts(graphics); return drawParagraphs(graphics, 0, 0); }
drawParagraphs(graphics, x, y);
/** * Compute the cumulative height occupied by the text * * @param oldGraphics the graphics context, which properties are to be copied, may be null * @return the height in points */ public double getTextHeight(Graphics2D oldGraphics) { // dry-run in a 1x1 image and return the vertical advance BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); if (oldGraphics != null) { graphics.addRenderingHints(oldGraphics.getRenderingHints()); graphics.setTransform(oldGraphics.getTransform()); } DrawFactory.getInstance(graphics).fixFonts(graphics); return drawParagraphs(graphics, 0, 0); }