Example usage for org.apache.pdfbox.pdmodel.font PDType1CFont getCFFType1Font

List of usage examples for org.apache.pdfbox.pdmodel.font PDType1CFont getCFFType1Font

Introduction

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

Prototype

public CFFType1Font getCFFType1Font() 

Source Link

Document

Returns the embedded Type 1-equivalent CFF font.

Usage

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

License:Apache License

private String getNamePDType1Font(String name, PDType1CFont font) throws IOException {
    String extra = "";
    CFFEncoding encoding = font.getCFFType1Font().getEncoding();
    String eClass = encoding.getClass().getName();
    if (eClass.equals("org.apache.fontbox.cff.CFFParser$Format1Encoding")) {
        extra = "f1enc";
    } else if (eClass.equals("org.apache.fontbox.cff.CFFParser$Format0Encoding")) {
        extra = "f0enc";
    }//from w w w  .j  ava  2s .  c o  m
    CFFCharset cs = font.getCFFType1Font().getCharset();
    List<Integer> sids = MergeCFFFonts.getSids(cs);
    if (!sids.isEmpty() && sids.get(0) < OTFSubSetFile.NUM_STANDARD_STRINGS) {
        extra += "stdcs";
    }
    if (cs.getClass().getName().equals("org.apache.fontbox.cff.CFFParser$Format1Charset")) {
        extra += "f1cs";
    }
    if (font.getEncoding() != null) {
        String enc = font.getEncoding().getClass().getSimpleName();
        if (!"DictionaryEncoding".equals(enc)) {
            extra += enc;
        }
    }
    return name + extra;
}