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

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

Introduction

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

Prototype

public PDStream getFontFile3() 

Source Link

Document

A stream containing a font program that is not true type or type 1.

Usage

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

License:Apache License

private InputStream readFontFile(PDFont font) throws IOException {
    PDFontDescriptor fd = font.getFontDescriptor();
    if (font instanceof PDType0Font) {
        PDCIDFont cidFont = ((PDType0Font) font).getDescendantFont();
        fd = cidFont.getFontDescriptor();
    }/*from   www .  ja va2 s  . c  o  m*/
    PDStream ff = fd.getFontFile3();
    if (ff == null) {
        ff = fd.getFontFile2();
        if (ff == null) {
            ff = fd.getFontFile();
        }
    }
    if (ff == null) {
        throw new IOException(font.getName() + " no fontfile");
    }
    InputStream is = ff.createInputStream();
    return new ByteArrayInputStream(IOUtils.toByteArray(is));
}

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());//  w  w  w. ja  v a2  s. com
    PDStream ff = fd.getFontFile3();
    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;
}