Example usage for com.lowagie.text.pdf BaseFont AWT_MAXADVANCE

List of usage examples for com.lowagie.text.pdf BaseFont AWT_MAXADVANCE

Introduction

In this page you can find the example usage for com.lowagie.text.pdf BaseFont AWT_MAXADVANCE.

Prototype

int AWT_MAXADVANCE

To view the source code for com.lowagie.text.pdf BaseFont AWT_MAXADVANCE.

Click Source Link

Document

java.awt.Font property

Usage

From source file:org.pentaho.reporting.libraries.fonts.itext.BaseFontFontMetrics.java

License:Open Source License

public BaseFontFontMetrics(final FontNativeContext record, final BaseFont baseFont, final float size) {
    if (baseFont == null) {
        throw new NullPointerException("BaseFont is invalid.");
    }//from www .  j av a  2s .c om

    this.record = record;
    this.baseFont = baseFont;
    this.size = size;
    this.cpBuffer = new char[4];
    this.cachedWidths = new long[256 - 32];
    Arrays.fill(cachedWidths, -1);

    sizeScaled = FontStrictGeomUtility.toInternalValue(size);

    this.ascent = (long) baseFont.getFontDescriptor(BaseFont.AWT_ASCENT, sizeScaled);
    this.descent = (long) -baseFont.getFontDescriptor(BaseFont.AWT_DESCENT, sizeScaled);
    this.leading = (long) baseFont.getFontDescriptor(BaseFont.AWT_LEADING, sizeScaled);
    italicsAngle = FontStrictGeomUtility
            .toInternalValue(baseFont.getFontDescriptor(BaseFont.ITALICANGLE, size));
    maxAscent = (long) baseFont.getFontDescriptor(BaseFont.BBOXURY, sizeScaled);
    maxDescent = (long) -baseFont.getFontDescriptor(BaseFont.BBOXLLY, sizeScaled);
    maxCharAdvance = (long) baseFont.getFontDescriptor(BaseFont.AWT_MAXADVANCE, sizeScaled);

    final int[] charBBox = this.baseFont.getCharBBox('x');
    if (charBBox != null) {
        this.xHeight = (long) (charBBox[3] * size);
    }
    if (this.xHeight == 0) {
        this.xHeight = getAscent() / 2;
    }
    this.trueTypeFont = baseFont.getFontType() == BaseFont.FONT_TYPE_TT
            || baseFont.getFontType() == BaseFont.FONT_TYPE_TTUNI;
}