public float getXHeight(FontSpecification parentFont) { return sharedContext.getXHeight(getFontContext(), parentFont); }
public float getXHeight(FontSpecification parentFont) { return sharedContext.getXHeight(getFontContext(), parentFont); }
public FSFontMetrics getFSFontMetrics(FSFont font) { return getTextRenderer().getFSFontMetrics(getFontContext(), font, ""); }
public FSFontMetrics getFSFontMetrics(FSFont font) { return getTextRenderer().getFSFontMetrics(getFontContext(), font, ""); }
public void updateDynamicValue(RenderingContext c) { String value = _functionData.getContentFunction().calculate( c, _functionData.getFunction(), this); _start = 0; _end = value.length(); _masterText = value; _width = c.getTextRenderer().getWidth( c.getFontContext(), getParent().getStyle().getFSFont(c), value); }
public void updateDynamicValue(RenderingContext c) { String value = _functionData.getContentFunction().calculate( c, _functionData.getFunction(), this); _start = 0; _end = value.length(); _masterText = value; _width = c.getTextRenderer().getWidth( c.getFontContext(), getParent().getStyle().getFSFont(c), value); }
/** * @param gc * @return a new {@link RenderingContext} */ protected RenderingContext newRenderingContext(GC gc) { RenderingContext result = _sharedContext.newRenderingContextInstance(); result.setFontContext(new SWTFontContext(gc)); result.setOutputDevice(new SWTOutputDevice(gc)); _sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
/** * @param gc * @return a new {@link RenderingContext} */ protected RenderingContext newRenderingContext(GC gc) { RenderingContext result = _sharedContext.newRenderingContextInstance(); result.setFontContext(new SWTFontContext(gc)); result.setOutputDevice(new SWTOutputDevice(gc)); _sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
private RenderingContext newRenderingContext() { RenderingContext result = _sharedContext.newRenderingContextInstance(); result.setFontContext(new ITextFontContext()); result.setOutputDevice(_outputDevice); _sharedContext.getTextRenderer().setup(result.getFontContext()); result.setRootLayer(_root.getLayer()); return result; }
private RenderingContext newRenderingContext() { RenderingContext result = _sharedContext.newRenderingContextInstance(); result.setFontContext(new ITextFontContext()); result.setOutputDevice(_outputDevice); _sharedContext.getTextRenderer().setup(result.getFontContext()); result.setRootLayer(_root.getLayer()); return result; }
private RenderingContext newRenderingContext() { RenderingContext result = _sharedContext.newRenderingContextInstance(); result.setFontContext(new ITextFontContext()); result.setOutputDevice(_outputDevice); _sharedContext.getTextRenderer().setup(result.getFontContext()); result.setRootLayer(_root.getLayer()); return result; }
private RenderingContext newRenderingContext() { RenderingContext result = _sharedContext.newRenderingContextInstance(); result.setFontContext(new ITextFontContext()); result.setOutputDevice(_outputDevice); _sharedContext.getTextRenderer().setup(result.getFontContext()); result.setRootLayer(_root.getLayer()); return result; }
private RenderingContext newRenderingContext() { RenderingContext result = _sharedContext.newRenderingContextInstance(); result.setFontContext(new ITextFontContext()); result.setOutputDevice(_outputDevice); _sharedContext.getTextRenderer().setup(result.getFontContext()); result.setRootLayer(_root.getLayer()); return result; }
private void drawFontMetrics(RenderingContext c, InlineText inlineText) { InlineLayoutBox iB = inlineText.getParent(); String text = inlineText.getSubstring(); setColor(new FSRGBColor(0xFF, 0x33, 0xFF)); FSFontMetrics fm = iB.getStyle().getFSFontMetrics(null); int width = c.getTextRenderer().getWidth( c.getFontContext(), iB.getStyle().getFSFont(c), text); int x = iB.getAbsX() + inlineText.getX(); int y = iB.getAbsY() + iB.getBaseline(); drawLine(x, y, x + width, y); y += (int) Math.ceil(fm.getDescent()); drawLine(x, y, x + width, y); y -= (int) Math.ceil(fm.getDescent()); y -= (int) Math.ceil(fm.getAscent()); drawLine(x, y, x + width, y); }
private void drawFontMetrics(RenderingContext c, InlineText inlineText) { InlineLayoutBox iB = inlineText.getParent(); String text = inlineText.getSubstring(); setColor(new FSRGBColor(0xFF, 0x33, 0xFF)); FSFontMetrics fm = iB.getStyle().getFSFontMetrics(null); int width = c.getTextRenderer().getWidth( c.getFontContext(), iB.getStyle().getFSFont(c), text); int x = iB.getAbsX() + inlineText.getX(); int y = iB.getAbsY() + iB.getBaseline(); drawLine(x, y, x + width, y); y += (int) Math.ceil(fm.getDescent()); drawLine(x, y, x + width, y); y -= (int) Math.ceil(fm.getDescent()); y -= (int) Math.ceil(fm.getAscent()); drawLine(x, y, x + width, y); }
/** * Renders the XML document if necessary and returns the resulting image. If already rendered, same image * reference will be returned. * * {@link #getImage(int)} with the target width. * * @return The XML rendered as a BufferedImage. */ public BufferedImage getImage() { if (!rendered) { setDocument((doc == null ? loadDocument(sourceDocument) : doc), sourceDocumentBase, new XhtmlNamespaceHandler()); layout(this.width); height = this.height == -1 ? root.getHeight() : this.height; outputImage = createBufferedImage(this.width, height); outputDevice = new Java2DOutputDevice(outputImage); Graphics2D newG = (Graphics2D) outputImage.getGraphics(); if ( renderingHints != null ) { newG.getRenderingHints().putAll(renderingHints); } RenderingContext rc = sharedContext.newRenderingContextInstance(); rc.setFontContext(new Java2DFontContext(newG)); rc.setOutputDevice(outputDevice); sharedContext.getTextRenderer().setup(rc.getFontContext()); root.getLayer().paint(rc); newG.dispose(); rendered = true; } return outputImage; }
/** * Renders the XML document if necessary and returns the root Box. If already rendered, same Box * reference will be returned. * * @return The XML rendered as a Box. */ public Box render() { if (!rendered) { setDocument(loadDocument(sourceDocument), sourceDocumentBase, new XhtmlNamespaceHandler()); layout(this.width); height = this.height == -1 ? root.getHeight() : this.height; BufferedImage outputImage = createBufferedImage(this.width, height); outputDevice = new Java2DOutputDevice(outputImage); Graphics2D newG = (Graphics2D) outputImage.getGraphics(); try { if ( renderingHints != null ) { newG.getRenderingHints().putAll(renderingHints); } RenderingContext rc = sharedContext.newRenderingContextInstance(); rc.setFontContext(new Java2DFontContext(newG)); rc.setOutputDevice(outputDevice); sharedContext.getTextRenderer().setup(rc.getFontContext()); root.getLayer().paint(rc); } finally { if (newG != null) newG.dispose(); } rendered = true; } return root; }
/** * Renders the XML document if necessary and returns the resulting image. If already rendered, same image * reference will be returned. * * {@link #getImage(int)} with the target width. * * @return The XML rendered as a BufferedImage. */ public BufferedImage getImage() { if (!rendered) { setDocument((doc == null ? loadDocument(sourceDocument) : doc), sourceDocumentBase, new XhtmlNamespaceHandler()); layout(this.width); height = this.height == -1 ? root.getHeight() : this.height; outputImage = createBufferedImage(this.width, height); outputDevice = new Java2DOutputDevice(outputImage); Graphics2D newG = (Graphics2D) outputImage.getGraphics(); if ( renderingHints != null ) { newG.getRenderingHints().putAll(renderingHints); } RenderingContext rc = sharedContext.newRenderingContextInstance(); rc.setFontContext(new Java2DFontContext(newG)); rc.setOutputDevice(outputDevice); sharedContext.getTextRenderer().setup(rc.getFontContext()); root.getLayer().paint(rc); newG.dispose(); rendered = true; } return outputImage; }
public RenderingContext newRenderingContext(Graphics2D g) { XRLog.layout(Level.FINEST, "new context begin"); getSharedContext().setCanvas(this); XRLog.layout(Level.FINEST, "new context end"); RenderingContext result = getSharedContext().newRenderingContextInstance(); result.setFontContext(new Java2DFontContext(g)); result.setOutputDevice(new Java2DOutputDevice(g)); getSharedContext().getTextRenderer().setup(result.getFontContext()); if (rootBox != null) { result.setRootLayer(rootBox.getLayer()); } return result; }
public RenderingContext newRenderingContext(Graphics2D g) { XRLog.layout(Level.FINEST, "new context begin"); getSharedContext().setCanvas(this); XRLog.layout(Level.FINEST, "new context end"); RenderingContext result = getSharedContext().newRenderingContextInstance(); result.setFontContext(new Java2DFontContext(g)); result.setOutputDevice(new Java2DOutputDevice(g)); getSharedContext().getTextRenderer().setup(result.getFontContext()); final Box rb = getRootBox(); if (rb != null) { result.setRootLayer(rb.getLayer()); } return result; }