/** * Applies a change in scale for fonts using the rendering context's text * renderer. */ private void scaleFont(float scaleBy) { SharedContext rc = getSharedContext(); float fs = rc.getTextRenderer().getFontScale() * scaleBy; if (fs < minFontScale || fs > maxFontScale) return; rc.getTextRenderer().setFontScale(fs); setDocument(getDocument()); }
public void actionPerformed(ActionEvent evt) { panel.getSharedContext().getTextRenderer().setSmoothingThreshold(fontSizeThreshold); panel.repaint(); } }
/** * Resets all rendered fonts on the current document to the font size * specified in the document's styling instructions. */ public void resetFontSize() { SharedContext rc = getSharedContext(); rc.getTextRenderer().setFontScale(1.0F); setDocument(getDocument()); }
/** * Resets all rendered fonts on the current document to the font size * specified in the document's styling instructions. */ public void resetFontSize() { SharedContext rc = getSharedContext(); rc.getTextRenderer().setFontScale(1.0F); setDocument(getDocument()); }
public float getXHeight(FontContext fontContext, FontSpecification fs) { FSFont font = getFontResolver().resolveFont(this, fs); FSFontMetrics fm = getTextRenderer().getFSFontMetrics(fontContext, font, " "); float sto = fm.getStrikethroughOffset(); return fm.getAscent() - 2 * Math.abs(sto) + fm.getStrikethroughThickness(); }
private LayoutContext newLayoutContext() { LayoutContext result = _sharedContext.newLayoutContextInstance(); result.setFontContext(new ITextFontContext()); _sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
private LayoutContext newLayoutContext() { LayoutContext result = _sharedContext.newLayoutContextInstance(); result.setFontContext(new ITextFontContext()); _sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
/** * @return a new {@link LayoutContext} */ protected LayoutContext newLayoutcontext(GC gc) { LayoutContext result = _sharedContext.newLayoutContextInstance(); result.setFontContext(new SWTFontContext(gc)); _sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
private LayoutContext newLayoutContext() { LayoutContext result = _sharedContext.newLayoutContextInstance(); result.setFontContext(new ITextFontContext()); _sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
public void init() throws Exception { Container contentPane = this.getContentPane(); XHTMLPanel panel = new XHTMLPanel(); panel.getSharedContext().getTextRenderer().setSmoothingThreshold(0); // Anti-aliasing for all font sizes panel.setDocument(new File("c:\\Temp\\MyExperiment\\T2 BioCatalogue Plugin\\BioCatalogue Plugin\\resources\\test.html")); FSScrollPane scroll = new FSScrollPane(panel); contentPane.add(scroll); this.setTitle("XHTML rendered test"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.pack(); this.setSize(1024, 768); }
private LayoutContext newLayoutContext() { LayoutContext result = sharedContext.newLayoutContextInstance(); result.setFontContext(new Java2DFontContext(outputDevice.getGraphics())); sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
private LayoutContext newLayoutContext() { LayoutContext result = sharedContext.newLayoutContextInstance(); result.setFontContext(new Java2DFontContext(outputDevice.getGraphics())); sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
private LayoutContext newLayoutContext() { LayoutContext result = sharedContext.newLayoutContextInstance(); result.setFontContext(new Java2DFontContext(outputDevice.getGraphics())); sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
protected LayoutContext newLayoutContext(Graphics2D g) { XRLog.layout(Level.FINEST, "new context begin"); getSharedContext().setCanvas(this); XRLog.layout(Level.FINEST, "new context end"); LayoutContext result = getSharedContext().newLayoutContextInstance(); Graphics2D layoutGraphics = g.getDeviceConfiguration().createCompatibleImage(1, 1).createGraphics(); result.setFontContext(new Java2DFontContext(layoutGraphics)); getSharedContext().getTextRenderer().setup(result.getFontContext()); return result; }
protected LayoutContext newLayoutContext(Graphics2D g) { XRLog.layout(Level.FINEST, "new context begin"); getSharedContext().setCanvas(this); XRLog.layout(Level.FINEST, "new context end"); LayoutContext result = getSharedContext().newLayoutContextInstance(); Graphics2D layoutGraphics = g.getDeviceConfiguration().createCompatibleImage(1, 1).createGraphics(); result.setFontContext(new Java2DFontContext(layoutGraphics)); getSharedContext().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; }