/** * @return true if any of the entries /DigestLocation, /DigestMethod, or * /DigestValue is present. */ @Override public Boolean getcontainsDigestEntries() { COSDictionary dictionary = (COSDictionary) this.simpleCOSObject.getDirectBase(); if (dictionary != null) { return Boolean.valueOf(dictionary.knownKey(ASAtom.DIGEST_LOCATION).booleanValue() || dictionary.knownKey(ASAtom.DIGEST_METHOD).booleanValue() || dictionary.knownKey(ASAtom.DIGEST_VALUE).booleanValue()); } return Boolean.FALSE; }
private static int columnsFromParams(COSDictionary decodeParams) { if (decodeParams.knownKey(ASAtom.COLUMNS)) { return decodeParams.getIntegerKey(ASAtom.COLUMNS).intValue(); } else { return COLUMNS_DEFAULT; } }
private static int bitsFromParams(COSDictionary decodeParams) { if (decodeParams.knownKey(ASAtom.BITS_PER_COMPONENT)) { return decodeParams.getIntegerKey(ASAtom.BITS_PER_COMPONENT).intValue(); } else { return BITS_PER_COMPONENT_DEFAULT; } }
/** * @return true if {@code NeedsRendering} entry in catalog contains * {@code true} value. */ @Override public Boolean getNeedsRendering() { if (!catalog.knownKey(ASAtom.NEEDS_RENDERING).booleanValue()) { return Boolean.valueOf(false); } return catalog.getBooleanKey(ASAtom.NEEDS_RENDERING); }
private static int colorsFromParams(COSDictionary decodeParams) { if (decodeParams.knownKey(ASAtom.COLORS)) { return decodeParams.getIntegerKey(ASAtom.COLORS).intValue(); } else { return COLORS_DEFAULT; } }
private static byte predictorFromParams(COSDictionary decodeParams) { if (decodeParams.knownKey(ASAtom.PREDICTOR)) { return (byte) decodeParams.getIntegerKey(ASAtom.PREDICTOR).intValue(); } else { return PREDICTOR_DEFAULT; } }
/** * Gets width for glyph with given code in this font. * * @param code is code of glyph. * @return width for glyph with given code as specified in Widths array. */ public Double getWidth(int code) { if (dictionary.knownKey(ASAtom.WIDTHS).booleanValue() && dictionary.knownKey(ASAtom.FIRST_CHAR).booleanValue() && dictionary.knownKey(ASAtom.LAST_CHAR).booleanValue()) { int firstChar = dictionary.getIntegerKey(ASAtom.FIRST_CHAR).intValue(); int lastChar = dictionary.getIntegerKey(ASAtom.LAST_CHAR).intValue(); if (getWidths().size().intValue() > 0 && code >= firstChar && code <= lastChar) { return getWidths().at(code - firstChar).getReal(); } } if (fontDescriptor.knownKey(ASAtom.MISSING_WIDTH)) { return fontDescriptor.getMissingWidth(); } if (this instanceof PDType3Font) { return null; } return Double.valueOf(0); }
/** * @return true if the document permissions dictionary contains DocMDP * entry. */ @Override public Boolean getpermsContainDocMDP() { PDCatalog catalog = StaticContainers.getDocument().getCatalog(); COSDictionary perms = (COSDictionary) catalog.getKey(ASAtom.PERMS).getDirectBase(); if (perms != null) { return perms.knownKey(GFPDPerms.DOC_MDP); } return Boolean.valueOf(false); } }
private void createCIDToNameTableFromDict(COSDictionary encoding) throws IOException { if (encoding.knownKey(ASAtom.BASE_ENCODING)) { ASAtom baseEncoding = encoding.getNameKey(ASAtom.BASE_ENCODING); if (ASAtom.WIN_ANSI_ENCODING.equals(baseEncoding)) { System.arraycopy(TrueTypePredefined.WIN_ANSI_ENCODING, 0, encodingMappingArray, 0, 256); } else if (ASAtom.MAC_ROMAN_ENCODING.equals(baseEncoding)) { System.arraycopy(TrueTypePredefined.MAC_ROMAN_ENCODING, 0, encodingMappingArray, 0, 256); } else if (ASAtom.getASAtom( TrueTypePredefined.MAC_EXPERT_ENCODING_STRING).equals(baseEncoding)) { System.arraycopy(TrueTypePredefined.MAC_EXPERT_ENCODING, 0, encodingMappingArray, 0, 256); } else { throw new IOException("Error in reading /Encoding entry in font dictionary"); } } else { System.arraycopy(TrueTypePredefined.STANDARD_ENCODING, 0, encodingMappingArray, 0, 256); } applyDiffsToEncoding(encoding); for (int i = 0; i < 256; ++i) { if (TrueTypePredefined.NOTDEF_STRING.equals(encodingMappingArray[i])) { encodingMappingArray[i] = TrueTypePredefined.STANDARD_ENCODING[i]; } } }