/** * {@inheritDoc} */ @Override public ASAtom getSubtype() { return this.type0FontDict.getNameKey(ASAtom.SUBTYPE); }
private static String[] getBaseEncoding(COSDictionary encoding) { ASAtom baseEncoding = encoding.getNameKey(ASAtom.BASE_ENCODING); if (baseEncoding == null) { return new String[]{}; } if (baseEncoding == ASAtom.MAC_ROMAN_ENCODING) { return Arrays.copyOf(TrueTypePredefined.MAC_ROMAN_ENCODING, TrueTypePredefined.MAC_ROMAN_ENCODING.length); } else if (baseEncoding == ASAtom.MAC_EXPERT_ENCODING) { return Arrays.copyOf(TrueTypePredefined.MAC_EXPERT_ENCODING, TrueTypePredefined.MAC_EXPERT_ENCODING.length); } else if (baseEncoding == ASAtom.WIN_ANSI_ENCODING) { return Arrays.copyOf(TrueTypePredefined.WIN_ANSI_ENCODING, TrueTypePredefined.WIN_ANSI_ENCODING.length); } else { return new String[]{}; } }
public PageLabelDictionary(COSDictionary dict, int rangeStartIndex) { this.type = dict.getNameKey(ASAtom.S); String prefixValue = dict.getStringKey(ASAtom.P); this.prefix = prefixValue == null ? "" : prefixValue; Long integerKey = dict.getIntegerKey(ASAtom.ST); this.firstRangePortion = integerKey == null ? 1 : integerKey.intValue(); this.rangeStartIndex = rangeStartIndex; }
@Override public String getSubtype() { ASAtom subtype = ((org.verapdf.pd.font.PDType0Font) this.pdFont).getType0FontDict().getNameKey(ASAtom.SUBTYPE); return subtype == null ? null : subtype.getValue(); }
/** * Get XMP metadata if it is present */ private List<PDMetadata> getMetadata() { COSDictionary dictionary = (COSDictionary) this.baseObject; COSObject meta = dictionary.getKey(ASAtom.METADATA); ASAtom type = dictionary.getNameKey(ASAtom.TYPE); if (meta != null && meta.getType() == COSObjType.COS_STREAM && type != ASAtom.CATALOG) { ArrayList<PDMetadata> pdMetadatas = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS); org.verapdf.pd.PDMetadata md = new org.verapdf.pd.PDMetadata(meta); pdMetadatas.add(new GFPDMetadata(md, Boolean.FALSE)); return Collections.unmodifiableList(pdMetadatas); } return Collections.emptyList(); }
/** {@inheritDoc} Create a GFCosFileSpecification COSDictionary if * value of type key of {@code obj} is file specification. Otherwise * create GFCosDict * @return GFCosFileSpecification or GFCosDict * @see GFCosDict * @see GFCosFileSpecification */ @Override public Object visitFromDictionary(COSDictionary obj) { ASAtom type = obj.getNameKey(ASAtom.TYPE); boolean isFileSpec = type != null && ASAtom.FILESPEC.equals(type); return isFileSpec ? new GFCosFileSpecification(obj) : new GFCosDict(obj); }
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]; } } }
/** * Constructor from COSDictionary. * * @param dictionary is font dictionary. */ public PDFont(COSDictionary dictionary) { super(new COSObject(dictionary)); if (dictionary == null) { dictionary = (COSDictionary) COSDictionary.construct().get(); } this.dictionary = dictionary; COSObject fd = dictionary.getKey(ASAtom.FONT_DESC); if (fd != null && fd.getType() == COSObjType.COS_DICT) { fontDescriptor = new PDFontDescriptor(fd); } else { fontDescriptor = new PDFontDescriptor(COSDictionary.construct()); } this.fontName = this.dictionary.getStringKey(ASAtom.BASE_FONT); this.subtype = this.dictionary.getNameKey(ASAtom.SUBTYPE); }