/** * <p>getFontHeight.</p> * * @param style a {@link net.sf.dynamicreports.design.base.style.DRDesignStyle} object. * @param rows a int. * @return a int. */ protected static int getFontHeight(DRDesignStyle style, int rows) { double height = getFont(style).getMaxCharBounds(context).getHeight(); return (int) Math.ceil(height * rows) + getVerticalPadding(style); }
public void setLineWidth(int lineWidth) { if (this.lineWidth != lineWidth) { this.lineWidth = lineWidth; int missingGlyphCode = font.getMissingGlyphCode(); FontRenderContext fontRenderContext = Platform.getFontRenderContext(); GlyphVector missingGlyphVector = font.createGlyphVector(fontRenderContext, new int[] {missingGlyphCode}); Rectangle2D textBounds = missingGlyphVector.getLogicalBounds(); Rectangle2D maxCharBounds = font.getMaxCharBounds(fontRenderContext); averageCharacterSize = new Dimensions((int)Math.ceil(textBounds.getWidth()), (int)Math.ceil(maxCharBounds.getHeight())); invalidateComponent(); } }
public void setLineWidth(int lineWidth) { if (this.lineWidth != lineWidth) { this.lineWidth = lineWidth; int missingGlyphCode = font.getMissingGlyphCode(); FontRenderContext fontRenderContext = Platform.getFontRenderContext(); GlyphVector missingGlyphVector = font.createGlyphVector(fontRenderContext, new int[] {missingGlyphCode}); Rectangle2D textBounds = missingGlyphVector.getLogicalBounds(); Rectangle2D maxCharBounds = font.getMaxCharBounds(fontRenderContext); averageCharacterSize = new Dimensions((int)Math.ceil(textBounds.getWidth()), (int)Math.ceil(maxCharBounds.getHeight())); invalidateComponent(); } }
/** * Sets the font of the text */ public void setFont(Font font) { if (font == null) { throw new IllegalArgumentException("font is null."); } this.font = font; int missingGlyphCode = font.getMissingGlyphCode(); FontRenderContext fontRenderContext = Platform.getFontRenderContext(); GlyphVector missingGlyphVector = font.createGlyphVector(fontRenderContext, new int[] {missingGlyphCode}); Rectangle2D textBounds = missingGlyphVector.getLogicalBounds(); Rectangle2D maxCharBounds = font.getMaxCharBounds(fontRenderContext); averageCharacterSize = new Dimensions((int)Math.ceil(textBounds.getWidth()), (int)Math.ceil(maxCharBounds.getHeight())); invalidateComponent(); }
/** * Sets the font of the text */ public void setFont(Font font) { if (font == null) { throw new IllegalArgumentException("font is null."); } this.font = font; int missingGlyphCode = font.getMissingGlyphCode(); FontRenderContext fontRenderContext = Platform.getFontRenderContext(); GlyphVector missingGlyphVector = font.createGlyphVector(fontRenderContext, new int[] {missingGlyphCode}); Rectangle2D textBounds = missingGlyphVector.getLogicalBounds(); Rectangle2D maxCharBounds = font.getMaxCharBounds(fontRenderContext); averageCharacterSize = new Dimensions((int)Math.ceil(textBounds.getWidth()), (int)Math.ceil(maxCharBounds.getHeight())); invalidateComponent(); }
Rectangle2D charRect = key.font.getMaxCharBounds(frc);
true, true); Rectangle2D charRect = key.font.getMaxCharBounds(frc); List<Shape> sList = new ArrayList<Shape>(lignes.length); for (int i = 0; i < lignes.length; i++) {
/** * <p>getFontHeight.</p> * * @param font a {@link net.sf.dynamicreports.report.base.style.DRFont} object. * @return a double. */ public static double getFontHeight(DRFont font) { Font fnt = getFont(font.getFontName(), font.getBold(), font.getItalic(), font.getFontSize()); return fnt.getMaxCharBounds(context).getHeight(); }
if (counter == 0) { FontRenderContext frcLocal = ((java.awt.Graphics2D) (parentEkit.getGraphics())).getFontRenderContext(); Rectangle2D fontBounds = buttonFont.getMaxCharBounds(frcLocal); int maxCharWidth = (int) (Math.abs(fontBounds.getX())) + (int) (Math.abs(fontBounds.getWidth())); int maxCharHeight = (int) (Math.abs(fontBounds.getY())) + (int) (Math.abs(fontBounds.getHeight()));
private void updateRowHeights() { if(! isDisplayable()){ addHierarchyListener(new HierarchyListener() { @Override public void hierarchyChanged(HierarchyEvent e) { if(isDisplayable()){ updateRowHeights(); removeHierarchyListener(this); } } }); return; } final int rowCount = getRowCount(); if (rowCount == 0) { return; } final float fontSize = (float) getFont().getMaxCharBounds(((Graphics2D)getGraphics()).getFontRenderContext()).getHeight(); final float zoom = getZoom(); final int extraHeight = (int)(zoom * EXTRA_HEIGHT + 0.7f); int rowHeight = Math.max(1, (int)fontSize + extraHeight); for (int i = 0; i < rowCount; i++) { setRowHeight(i, rowHeight + (i == highRowIndex ? AttributeTable.EXTRA_HEIGHT : 0)); } }
public AWTFontMetrics( final FontNativeContext record, final Font font, final FontContext context ) { this.record = record; this.font = font; this.frc = new FontRenderContext( null, context.isAntiAliased(), context.isFractionalMetrics() ); final Graphics2D graphics = createGraphics( context ); // This is some sort of evil hack and does only play well as long as we deal with scalable fonts // It will happily cause troubles with bitmap fonts. java.awt.FontMetrics fontMetrics = graphics.getFontMetrics( font.deriveFont( font.getSize2D() * 1000 ) ); this.leading = fontMetrics.getLeading(); this.maxAscent = fontMetrics.getMaxAscent(); this.maxDescent = fontMetrics.getMaxDescent(); this.uniformLineMetrics = fontMetrics.hasUniformLineMetrics(); final Rectangle2D rect = this.font.getMaxCharBounds( frc ); this.maxCharAdvance = FontStrictGeomUtility.toInternalValue( rect.getWidth() ); this.ascent = FontStrictGeomUtility.toInternalValue( -rect.getY() ); this.descent = FontStrictGeomUtility.toInternalValue( rect.getHeight() + rect.getY() ); final GlyphVector gv = font.createGlyphVector( frc, "x" ); final Rectangle2D bounds = gv.getVisualBounds(); this.xheight = FontStrictGeomUtility.toInternalValue( bounds.getHeight() ); this.cpBuffer = new char[ 4 ]; this.cachedBaselines = new BaselineInfo[ 256 - 32 ]; this.cachedWidths = new long[ 256 - 32 ]; Arrays.fill( cachedWidths, -1 ); }
maxCharBounds = awtFont.getMaxCharBounds(frc); ascent = textLayout.getAscent(); descent = textLayout.getDescent();
Rectangle2D charBounds = font.getMaxCharBounds(_frc); width += getMarginLeft() + getMarginRight() + charBounds.getWidth();
this.fontBBox = font.getMaxCharBounds(context);
this.fontBBox = font.getMaxCharBounds(context);