Example usage for org.apache.pdfbox.pdmodel.font PDFontDescriptor getFlags

List of usage examples for org.apache.pdfbox.pdmodel.font PDFontDescriptor getFlags

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.font PDFontDescriptor getFlags.

Prototype

public int getFlags() 

Source Link

Document

This will get the font flags.

Usage

From source file:net.timendum.pdf.StatisticParser.java

License:Open Source License

public boolean isItalic(PDFontDescriptor descriptor) {
    if (descriptor.getItalicAngle() != 0f) {
        return true;
    }//from  w  w w  .j a v a2s.c  om
    if ((descriptor.getFlags() & FLAG_ITALIC) == FLAG_ITALIC) {
        return true;
    }
    if (descriptor.getFontName() != null && descriptor.getFontName().indexOf("Italic") > -1) {
        return true;
    }
    return false;
}

From source file:net.timendum.pdf.StatisticParser.java

License:Open Source License

public boolean isBold(PDFontDescriptor descriptor) {
    if (descriptor.getFontWeight() > averangeFontWeight) {
        return true;
    }/* ww w.  j a va 2 s.  com*/
    if ((descriptor.getFlags() & FLAG_FORCE_BOLD) == FLAG_FORCE_BOLD) {
        return true;
    }
    if (descriptor.getFontName() != null && descriptor.getFontName().indexOf("Bold") > -1) {
        return true;
    }
    return false;
}

From source file:org.apache.fop.render.pdf.pdfbox.FOPPDFSingleByteFont.java

License:Apache License

private PDStream readFontFile(PDFont font) throws IOException {
    PDFontDescriptor fd = font.getFontDescriptor();
    setFlags(fd.getFlags());
    PDStream ff = fd.getFontFile3();//from   w  w  w.j ava 2s  .  c o m
    if (ff == null) {
        ff = fd.getFontFile2();
        if (ff == null) {
            ff = fd.getFontFile();
        }
    } else {
        setFontType(FontType.TYPE1C);
    }
    if (ff == null) {
        throw new IOException(font.getName() + " no font file");
    }
    return ff;
}