@Override public boolean equals(Object other) { return other instanceof PDFont && ((PDFont) other).getCOSObject() == this.getCOSObject(); }
@Override public int hashCode() { return this.getCOSObject().hashCode(); }
public List<Float> getWidths(PDFont font) { List<Float> widths; COSArray array = (COSArray) font.getCOSObject().getDictionaryObject(COSName.WIDTHS); if (array != null) { widths = COSArrayList.convertFloatCOSArrayToList(array); } else { widths = Collections.emptyList(); } return widths; }
/** * Check the CMap entry. * * The CMap entry must be a dictionary in a PDF/A. This entry can be a String only if the String value is Identity-H * or Identity-V */ @Override protected void checkEncoding() { COSBase encoding = (font.getCOSObject()).getItem(COSName.ENCODING); checkCMapEncoding(encoding); }
public Type0FontValidator(PreflightContext context, PDFont font) { super(context, font.getCOSObject(), new Type0Container(font)); cosDocument = this.context.getDocument().getDocument(); this.font = font; }
@Override public boolean equals(Object other) { return other instanceof PDFont && ((PDFont) other).getCOSObject() == this.getCOSObject(); }
@Override public boolean equals(Object other) { return other instanceof PDFont && ((PDFont) other).getCOSObject() == this.getCOSObject(); }
/** * This methods extracts from the Font dictionary all mandatory fields. If a mandatory field is missing, the list of * ValidationError in the FontContainer is updated. */ protected void checkMandatoryFields() { COSDictionary fontDictionary = font.getCOSObject(); boolean areFieldsPResent = fontDictionary.containsKey(COSName.TYPE); areFieldsPResent &= fontDictionary.containsKey(COSName.SUBTYPE); areFieldsPResent &= fontDictionary.containsKey(COSName.BASE_FONT); areFieldsPResent &= fontDictionary.containsKey(COSName.DESCENDANT_FONTS); areFieldsPResent &= fontDictionary.containsKey(COSName.ENCODING); if (!areFieldsPResent) { this.fontContainer.push(new ValidationError(ERROR_FONTS_DICTIONARY_INVALID, font.getName() + ": Some keys are missing from composite font dictionary")); } }
@Override public int hashCode() { return this.getCOSObject().hashCode(); }
@Override public int hashCode() { return this.getCOSObject().hashCode(); }
@Override public void validate(PreflightContext context) throws ValidationException { PreflightPath vPath = context.getValidationPath(); if (vPath.isEmpty()) { return; } if (!vPath.isExpectedType(PDFont.class)) { context.addValidationError(new ValidationError(PreflightConstants.ERROR_FONTS_INVALID_DATA, "Font validation process needs at least one PDFont object")); } else { PDFont font = (PDFont) vPath.peek(); FontContainer<?> fontContainer = context.getFontContainer(font.getCOSObject()); if (fontContainer == null) { // if fontContainer isn't null the font is already checked FontValidator<? extends FontContainer<? extends PDFont>> validator = getFontValidator(context, font); if (validator != null) { validator.validate(); } } } }
/** * The CIDSystemInfo must have the same Registry and Ordering for CMap and CIDFont. This control is useless if CMap * is Identity-H or Identity-V so this method is called by the checkCMap method. * * @param cmap */ private void compareCIDSystemInfo(COSDictionary cmap) { COSDictionary fontDictionary = font.getCOSObject(); COSArray array = COSUtils.getAsArray(fontDictionary.getItem(COSName.DESCENDANT_FONTS), cosDocument); if (array != null && array.size() > 0) { COSDictionary cidFont = COSUtils.getAsDictionary(array.get(0), cosDocument); COSDictionary cmsi = COSUtils.getAsDictionary(cmap.getItem(COSName.CIDSYSTEMINFO), cosDocument); COSDictionary cfsi = COSUtils.getAsDictionary(cidFont.getItem(COSName.CIDSYSTEMINFO), cosDocument); String regCM = COSUtils.getAsString(cmsi.getItem(COSName.REGISTRY), cosDocument); String ordCM = COSUtils.getAsString(cmsi.getItem(COSName.ORDERING), cosDocument); String regCF = COSUtils.getAsString(cfsi.getItem(COSName.REGISTRY), cosDocument); String ordCF = COSUtils.getAsString(cfsi.getItem(COSName.ORDERING), cosDocument); if (!regCF.equals(regCM) || !ordCF.equals(ordCM)) { this.fontContainer.push(new ValidationError(ERROR_FONTS_CIDKEYED_SYSINFO, font.getName() + ": The CIDSystemInfo is inconsistent")); } } } }
FontContainer<?> fontContainer = context.getFontContainer(font.getCOSObject()); if (renderingMode == RenderingMode.NEITHER && (fontContainer == null || !fontContainer.isEmbeddedFont()))
COSDictionary fontDictionary = font.getCOSObject();
FontContainer<?> aContainer = this.context.getFontContainer(aFont.getCOSObject());
/** * Check the CMap entry. * * The CMap entry must be a dictionary in a PDF/A. This entry can be a String only if the String value is Identity-H * or Identity-V */ @Override protected void checkEncoding() { COSBase encoding = (font.getCOSObject()).getItem(COSName.ENCODING); checkCMapEncoding(encoding); }
/** * Check the CMap entry. * * The CMap entry must be a dictionary in a PDF/A. This entry can be a String only if the String value is Identity-H * or Identity-V */ @Override protected void checkEncoding() { COSBase encoding = (font.getCOSObject()).getItem(COSName.ENCODING); checkCMapEncoding(encoding); }
public Type0FontValidator(PreflightContext context, PDFont font) { super(context, font.getCOSObject(), new Type0Container(font)); cosDocument = this.context.getDocument().getDocument(); this.font = font; }
public Type0FontValidator(PreflightContext context, PDFont font) { super(context, font.getCOSObject(), new Type0Container(font)); cosDocument = this.context.getDocument().getDocument(); this.font = font; }
private static void processFont(PDFont font) { if (font instanceof PDType3Font && !isKeyVisited(font.getCOSObject().getKey())) { parseResources(((PDType3Font) font).getResources()); } }