/** * If the embedded font is a subset, the CIDSet entry is mandatory and must be a Stream. If the CIDSet entry doesn't * respects conditions, the FontContainer is updated. * * @param pfDescriptor */ protected void checkCIDSet(PDFontDescriptor pfDescriptor) { if (isSubSet(pfDescriptor.getFontName())) { COSDocument cosDocument = context.getDocument().getDocument(); COSBase cidset = pfDescriptor.getCOSObject().getItem(COSName.getPDFName(FONT_DICTIONARY_KEY_CIDSET)); if (cidset == null || !COSUtils.isStream(cidset, cosDocument)) { this.fContainer.push(new ValidationResult.ValidationError(ERROR_FONTS_CIDSET_MISSING_FOR_SUBSET, pfDescriptor.getFontName() + ": The CIDSet entry is missing for the Composite Subset")); } } }
/** * If the embedded font is a subset, the CIDSet entry is mandatory and must be a Stream. If the CIDSet entry doesn't * respects conditions, the FontContainer is updated. * * @param pfDescriptor */ protected void checkCIDSet(PDFontDescriptor pfDescriptor) { if (isSubSet(pfDescriptor.getFontName())) { COSDocument cosDocument = context.getDocument().getDocument(); COSBase cidset = pfDescriptor.getCOSObject().getItem(COSName.getPDFName(FONT_DICTIONARY_KEY_CIDSET)); if (cidset == null || !COSUtils.isStream(cidset, cosDocument)) { this.fContainer.push(new ValidationResult.ValidationError(ERROR_FONTS_CIDSET_MISSING_FOR_SUBSET, pfDescriptor.getFontName() + ": The CIDSet entry is missing for the Composite Subset")); } } }
private COSDictionary createCIDFont() throws IOException { COSDictionary cidFont = new COSDictionary(); // Type, Subtype cidFont.setItem(COSName.TYPE, COSName.FONT); cidFont.setItem(COSName.SUBTYPE, COSName.CID_FONT_TYPE2); // BaseFont cidFont.setName(COSName.BASE_FONT, fontDescriptor.getFontName()); // CIDSystemInfo COSDictionary info = toCIDSystemInfo("Adobe", "Identity", 0); cidFont.setItem(COSName.CIDSYSTEMINFO, info); // FontDescriptor cidFont.setItem(COSName.FONT_DESC, fontDescriptor.getCOSObject()); // W - widths buildWidths(cidFont); // Vertical metrics if (vertical) { buildVerticalMetrics(cidFont); } // CIDToGIDMap cidFont.setItem(COSName.CID_TO_GID_MAP, COSName.IDENTITY); return cidFont; }
@Override public Long getFlags() { COSBase fl = descriptor.getCOSObject().getDictionaryObject(COSName.FLAGS); if (fl instanceof COSInteger) { return Long.valueOf(((COSInteger) fl).intValue()); } return null; }
@Override public Double getFontWeight() { if (descriptor.getCOSObject().containsKey(COSName.FONT_WEIGHT)) { return Double.valueOf(descriptor.getFontWeight()); } return null; }
@Override public Double getStemV() { if (descriptor.getCOSObject().containsKey(COSName.STEM_V)) { return Double.valueOf(descriptor.getStemV()); } return null; }
checkMandatoryFields(fontDescriptor.getCOSObject());
/** * If the embedded font is a subset, the CIDSet entry is mandatory and must be a Stream. If the CIDSet entry doesn't * respects conditions, the FontContainer is updated. * * @param pfDescriptor */ protected void checkCIDSet(PDFontDescriptor pfDescriptor) { if (isSubSet(pfDescriptor.getFontName())) { COSDocument cosDocument = context.getDocument().getDocument(); COSBase cidset = pfDescriptor.getCOSObject().getItem(COSName.getPDFName(FONT_DICTIONARY_KEY_CIDSET)); if (cidset == null || !COSUtils.isStream(cidset, cosDocument)) { this.fContainer.push(new ValidationResult.ValidationError(ERROR_FONTS_CIDSET_MISSING_FOR_SUBSET, pfDescriptor.getFontName() + ": The CIDSet entry is missing for the Composite Subset")); } } }
/** * If the embedded font is a subset, the CIDSet entry is mandatory and must be a Stream. If the CIDSet entry doesn't * respects conditions, the FontContainer is updated. * * @param pfDescriptor */ protected void checkCIDSet(PDFontDescriptor pfDescriptor) { if (isSubSet(pfDescriptor.getFontName())) { COSDocument cosDocument = context.getDocument().getDocument(); COSBase cidset = pfDescriptor.getCOSObject().getItem(COSName.getPDFName(FONT_DICTIONARY_KEY_CIDSET)); if (cidset == null || !COSUtils.isStream(cidset, cosDocument)) { this.fContainer.push(new ValidationResult.ValidationError(ERROR_FONTS_CIDSET_MISSING_FOR_SUBSET, pfDescriptor.getFontName() + ": The CIDSet entry is missing for the Composite Subset")); } } }
private COSDictionary createCIDFont() throws IOException { COSDictionary cidFont = new COSDictionary(); // Type, Subtype cidFont.setItem(COSName.TYPE, COSName.FONT); cidFont.setItem(COSName.SUBTYPE, COSName.CID_FONT_TYPE2); // BaseFont cidFont.setName(COSName.BASE_FONT, fontDescriptor.getFontName()); // CIDSystemInfo COSDictionary info = toCIDSystemInfo("Adobe", "Identity", 0); cidFont.setItem(COSName.CIDSYSTEMINFO, info); // FontDescriptor cidFont.setItem(COSName.FONT_DESC, fontDescriptor.getCOSObject()); // W - widths buildWidths(cidFont); // CIDToGIDMap cidFont.setItem(COSName.CID_TO_GID_MAP, COSName.IDENTITY); return cidFont; }
/** * If the embedded font is a subset, the CIDSet entry is mandatory and must be a Stream. If the CIDSet entry doesn't * respects conditions, the FontContainer is updated. * * @param pfDescriptor */ protected void checkCIDSet(PDFontDescriptor pfDescriptor) { if (isSubSet(pfDescriptor.getFontName())) { COSDocument cosDocument = context.getDocument().getDocument(); COSBase cidset = pfDescriptor.getCOSObject().getItem(COSName.getPDFName(FONT_DICTIONARY_KEY_CIDSET)); if (cidset == null || !COSUtils.isStream(cidset, cosDocument)) { this.fContainer.push(new ValidationResult.ValidationError(ERROR_FONTS_CIDSET_MISSING_FOR_SUBSET, pfDescriptor.getFontName() + ": The CIDSet entry is missing for the Composite Subset")); } } }
/** * If the embedded font is a subset, the CIDSet entry is mandatory and must be a Stream. If the CIDSet entry doesn't * respects conditions, the FontContainer is updated. * * @param pfDescriptor */ protected void checkCIDSet(PDFontDescriptor pfDescriptor) { if (isSubSet(pfDescriptor.getFontName())) { COSDocument cosDocument = context.getDocument().getDocument(); COSBase cidset = pfDescriptor.getCOSObject().getItem(COSName.getPDFName(FONT_DICTIONARY_KEY_CIDSET)); if (cidset == null || !COSUtils.isStream(cidset, cosDocument)) { this.fContainer.push(new ValidationResult.ValidationError(ERROR_FONTS_CIDSET_MISSING_FOR_SUBSET, pfDescriptor.getFontName() + ": The CIDSet entry is missing for the Composite Subset")); } } }
private COSDictionary createCIDFont() throws IOException { COSDictionary cidFont = new COSDictionary(); // Type, Subtype cidFont.setItem(COSName.TYPE, COSName.FONT); cidFont.setItem(COSName.SUBTYPE, COSName.CID_FONT_TYPE2); // BaseFont cidFont.setName(COSName.BASE_FONT, fontDescriptor.getFontName()); // CIDSystemInfo COSDictionary info = toCIDSystemInfo("Adobe", "Identity", 0); cidFont.setItem(COSName.CIDSYSTEMINFO, info); // FontDescriptor cidFont.setItem(COSName.FONT_DESC, fontDescriptor.getCOSObject()); // W - widths buildWidths(cidFont); // Vertical metrics if (vertical) { buildVerticalMetrics(cidFont); } // CIDToGIDMap cidFont.setItem(COSName.CID_TO_GID_MAP, COSName.IDENTITY); return cidFont; }
checkMandatoryFields(fontDescriptor.getCOSObject());
checkMandatoryFields(fontDescriptor.getCOSObject());