private FontRenderContext getCurrentContext(Editor editor) { FontRenderContext editorContext = FontInfo.getFontRenderContext(editor.getContentComponent()); return new FontRenderContext(editorContext.getTransform(), AntialiasingType.getKeyForCurrentScope(false), editor instanceof EditorImpl ? ((EditorImpl)editor).myFractionalMetricsHintValue : RenderingHints.VALUE_FRACTIONALMETRICS_OFF); } }
Graphics2D g = GraphicsEnvironment.getLocalGraphicsEnvironment().createGraphics(img); AffineTransform transform = g.getFontRenderContext() .getTransform();
FontRenderContext context = tree.getFontMetrics(currentFont).getFontRenderContext(); context.getTransform().transform(p, p); int fontSizeInPixels = (int) Math.ceil(p.getY());
protected Shape getGlyph(int i) { // This one-line implementation produces different results under JDK 1.3 // and 1.4 // return glyphs.getGlyphOutline(i); // The substitute code attempts to work around this by using defensive // programming // See code marked FONTHACK elsewhere in this file // Create a GlyphVector for this single character. FontRenderContext orig = getContext(); FontRenderContext frc = new FontRenderContext(null, orig .isAntiAliased(), orig.usesFractionalMetrics()); Shape shape = font.createGlyphVector(frc, new char[] { getUnicode(i) }) .getGlyphOutline(0); return orig.getTransform().createTransformedShape(shape); }
protected Shape getGlyph(int i) { // This one-line implementation produces different results under JDK 1.3 // and 1.4 // return glyphs.getGlyphOutline(i); // The substitute code attempts to work around this by using defensive // programming // See code marked FONTHACK elsewhere in this file // Create a GlyphVector for this single character. FontRenderContext orig = getContext(); FontRenderContext frc = new FontRenderContext(null, orig .isAntiAliased(), orig.usesFractionalMetrics()); Shape shape = font.createGlyphVector(frc, new char[] { getUnicode(i) }) .getGlyphOutline(0); return orig.getTransform().createTransformedShape(shape); }
suggestedFontRenderContext.getTransform(), antialiasing, false);