DrawFactory.getInstance(graphics).fixFonts(graphics); TextShape<?,?> s = getShape(); break; case BOTTOM: textHeight = getTextHeight(graphics); y += anchor.getHeight() - textHeight - insets.bottom; break; case MIDDLE: textHeight = getTextHeight(graphics); double delta = anchor.getHeight() - textHeight - insets.top - insets.bottom; y += insets.top + delta/2; drawParagraphs(graphics, x, y);
public DrawTextShape getDrawable(TextShape<?,?> shape) { return new DrawTextShape(shape); }
/** * Compute the cumulative height occupied by the text * * @return the height in points */ public double getTextHeight() { return getTextHeight(null); }
/** * 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); }
public void drawContent(Graphics2D graphics) { Drawable d = getGroupShape(graphics); if (d != null) { d.drawContent(graphics); return; } TableShape<?,?> ts = getShape(); DrawFactory df = DrawFactory.getInstance(graphics); final int rows = ts.getNumberOfRows(); final int cols = ts.getNumberOfColumns(); for (int row=0; row<rows; row++) { for (int col=0; col<cols; col++) { TableCell<?,?> tc = ts.getCell(row, col); if (tc != null) { DrawTextShape dts = df.getDrawable(tc); dts.drawContent(graphics); } } } }
Iterator<? extends TextParagraph<?,?,? extends TextRun>> paragraphs = getShape().iterator();
@Override public double getTextHeight(Graphics2D graphics) { DrawFactory drawFact = DrawFactory.getInstance(graphics); DrawTextShape dts = drawFact.getDrawable(this); return dts.getTextHeight(graphics); }
/** * 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); }
public void drawContent(Graphics2D graphics) { Drawable d = getGroupShape(graphics); if (d != null) { d.drawContent(graphics); return; } TableShape<?,?> ts = getShape(); DrawFactory df = DrawFactory.getInstance(graphics); final int rows = ts.getNumberOfRows(); final int cols = ts.getNumberOfColumns(); for (int row=0; row<rows; row++) { for (int col=0; col<cols; col++) { TableCell<?,?> tc = ts.getCell(row, col); if (tc != null) { DrawTextShape dts = df.getDrawable(tc); dts.drawContent(graphics); } } } }
Iterator<? extends TextParagraph<?,?,? extends TextRun>> paragraphs = getShape().iterator();
DrawFactory.getInstance(graphics).fixFonts(graphics); TextShape<?,?> s = getShape(); break; case BOTTOM: textHeight = getTextHeight(graphics); y += anchor.getHeight() - textHeight - insets.bottom; break; case MIDDLE: textHeight = getTextHeight(graphics); double delta = anchor.getHeight() - textHeight - insets.top - insets.bottom; y += insets.top + delta/2; drawParagraphs(graphics, x, y);
maxHeight = Math.max(maxHeight, dts.getTextHeight());
public DrawTextShape getDrawable(TextShape<?,?> shape) { return new DrawTextShape(shape); }
/** * Compute the cumulative height occupied by the text * * @return the height in points */ public double getTextHeight() { return getTextHeight(null); }
@Override public double getTextHeight(Graphics2D graphics) { DrawFactory drawFact = DrawFactory.getInstance(graphics); DrawTextShape dts = drawFact.getDrawable(this); return dts.getTextHeight(graphics); }
@Override public double getTextHeight(Graphics2D graphics) { DrawFactory drawFact = DrawFactory.getInstance(graphics); DrawTextShape dts = drawFact.getDrawable(this); return dts.getTextHeight(graphics); }
maxHeight = Math.max(maxHeight, dts.getTextHeight());