/** * @return widths of the font as specified in Widths key of font dictionary. */ public COSObject getWidths() { return this.dictionary.getKey(ASAtom.WIDTHS); }
/** * @return encoding of the font as specified in Encoding key of font * dictionary. */ public COSObject getEncoding() { return this.dictionary.getKey(ASAtom.ENCODING); }
/** * @return a specification of the mapping from CIDs to glyph indices if * CIDFont is a Type 2 CIDFont. */ public COSObject getCIDToGIDMap() { return this.dictionary.getKey(ASAtom.CID_TO_GID_MAP); }
/** * @return dictionary with char proc values. */ public COSDictionary getCharProcDict() { return (COSDictionary) this.dictionary.getKey(ASAtom.CHAR_PROCS).getDirectBase(); }
/** * Default constructor * @param dictionary greenfield COSDictionary */ public GFCosTrailer(COSDictionary dictionary) { super(dictionary, COS_TRAILER_TYPE); this.isEncrypted = dictionary.getKey(ASAtom.ENCRYPT).get() != null; }
/** * @return CID System Info object for this CIDFont. */ public PDCIDSystemInfo getCIDSystemInfo() { if (this.cidSystemInfo != null) { return this.cidSystemInfo; } else { this.cidSystemInfo = new PDCIDSystemInfo(this.dictionary.getKey(ASAtom.CID_SYSTEM_INFO)); return this.cidSystemInfo; } } }
private COSDictionary getCharProcs() { return (COSDictionary) this.dictionary.getKey(ASAtom.CHAR_PROCS).getDirectBase(); }
public Long getIntegerKey(final ASAtom key) { return getKey(key).getInteger(); }
public String getStringKey(final ASAtom key) { return getKey(key).getString(); }
public final ASAtom getNameKey(final ASAtom key) { return getKey(key).getName(); }
public Double getRealKey(final ASAtom key) { return getKey(key).getReal(); }
private boolean parseOptionalContentPresent() { return this.catalog != null && !(this.catalog.getKey(ASAtom.OCPROPERTIES).empty()); }
private static List<String> getDName(final COSDictionary contentProperties) { List<String> result = new ArrayList<>(); COSObject defaultConfig = contentProperties.getKey(ASAtom.D); if (defaultConfig.getType() == COSObjType.COS_DICT) { String name = defaultConfig.getStringKey(ASAtom.NAME); if (name != null) { result.add(name); } } return result; }
@Override public Boolean getcontainsEmbeddedFiles() { if (catalog != null) { COSObject names = this.catalog.getKey(ASAtom.NAMES); if (names.getType() == COSObjType.COS_DICT) { return names.knownKey(ASAtom.EMBEDDED_FILES); } } return Boolean.valueOf(false); }
/** * @return a list of streams for available embedded files. */ public List<COSStream> getEmbeddedFileStreams() { List<COSStream> res = new ArrayList<>(); for (ASAtom fileKey : DEFINED_FILE_KEYS) { COSObject fileStream = dictionary.getKey(fileKey); if (!fileStream.empty() && fileStream.getType() == COSObjType.COS_STREAM) { res.add((COSStream) fileStream.getDirectBase()); } } return Collections.unmodifiableList(res); }
private COSObject getAttribute(ASAtom attributeName, COSObjType expectedType) { if (this.propertiesDict != null) { COSObject res = this.propertiesDict.getKey(attributeName); if (res != null && !res.empty() && res.getType() == expectedType) { return res; } } return null; }
/** * @return COSObject that is font dictionary for descendant font. */ public COSObject getDescendantFontObject() { if (this.type0FontDict != null) { COSArray array = (COSArray) this.type0FontDict.getKey(ASAtom.DESCENDANT_FONTS).getDirectBase(); if (array != null) { return array.at(0); } } return null; }
private static COSDictionary getDescendantCOSDictionary(COSDictionary dict) { if (dict != null) { COSArray array = (COSArray) dict.getKey(ASAtom.DESCENDANT_FONTS).getDirectBase(); if (array != null) { return (COSDictionary) array.at(0).getDirectBase(); } } return null; }
/** * {@inheritDoc} */ @Override public Double getDefaultWidth() { COSObject dw = this.dictionary.getKey(ASAtom.DW); if (dw.getType().isNumber()) { return dw.getReal(); } else { return DEFAULT_CID_FONT_WIDTH; } }
private COSObject getCharProc(int code) { String glyphName = this.getEncodingMapping().getName(code); COSDictionary charProcs = this.getCharProcs(); if (charProcs != null) { ASAtom asAtomGlyph = ASAtom.getASAtom(glyphName); return charProcs.getKey(asAtomGlyph); } return COSObject.getEmpty(); }