Package org.apache.pdfbox.preflight.font
Class Type0FontValidator
- java.lang.Object
-
- org.apache.pdfbox.preflight.font.FontValidator<Type0Container>
-
- org.apache.pdfbox.preflight.font.Type0FontValidator
-
public class Type0FontValidator extends FontValidator<Type0Container>
-
-
Field Summary
Fields Modifier and Type Field Description protected COSDocument
cosDocument
protected PDFont
font
-
Fields inherited from class org.apache.pdfbox.preflight.font.FontValidator
context, descriptorHelper, fontContainer
-
-
Constructor Summary
Constructors Constructor Description Type0FontValidator(PreflightContext context, PDFont font)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
checkCIDSystemInfo(COSBase sysinfo)
Check the content of the CIDSystemInfo dictionary.protected void
checkCMapEncoding(COSBase encoding)
protected void
checkEncoding()
Check the CMap entry.protected void
checkMandatoryFields()
This methods extracts from the Font dictionary all mandatory fields.private void
compareCIDSystemInfo(COSDictionary cmap)
The CIDSystemInfo must have the same Registry and Ordering for CMap and CIDFont.protected FontValidator<? extends FontContainer<PDCIDFontType0>>
createCIDType0FontValidator(COSDictionary fDict)
Create the validation object for CIDType0 Fontprotected FontValidator<? extends FontContainer<PDCIDFontType2>>
createCIDType2FontValidator(COSDictionary fDict)
Create the validation object for CIDType2 Fontprotected FontValidator<? extends FontContainer<? extends PDCIDFont>>
createDescendantValidator(COSDictionary cidFont)
private void
processCMapAsStream(COSStream aCMap)
This method checks mandatory fields of the CMap stream.protected void
processDescendantFont()
Extract the single CIDFont from the descendant array.void
validate()
-
Methods inherited from class org.apache.pdfbox.preflight.font.FontValidator
checkToUnicode, getFontContainer
-
-
-
-
Field Detail
-
font
protected PDFont font
-
cosDocument
protected COSDocument cosDocument
-
-
Constructor Detail
-
Type0FontValidator
public Type0FontValidator(PreflightContext context, PDFont font)
-
-
Method Detail
-
validate
public void validate() throws ValidationException
- Specified by:
validate
in classFontValidator<Type0Container>
- Throws:
ValidationException
-
checkMandatoryFields
protected void checkMandatoryFields()
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.
-
processDescendantFont
protected void processDescendantFont() throws ValidationException
Extract the single CIDFont from the descendant array. Create a FontValidator for this CIDFont and launch its validation.- Throws:
ValidationException
- if there is an error validating the CIDFont.
-
createDescendantValidator
protected FontValidator<? extends FontContainer<? extends PDCIDFont>> createDescendantValidator(COSDictionary cidFont)
-
createCIDType0FontValidator
protected FontValidator<? extends FontContainer<PDCIDFontType0>> createCIDType0FontValidator(COSDictionary fDict)
Create the validation object for CIDType0 Font
-
createCIDType2FontValidator
protected FontValidator<? extends FontContainer<PDCIDFontType2>> createCIDType2FontValidator(COSDictionary fDict)
Create the validation object for CIDType2 Font- Parameters:
fDict
- a CIDType2 font dictionary.- Returns:
- a CIDType2 tont font validator.
-
checkEncoding
protected void checkEncoding()
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- Overrides:
checkEncoding
in classFontValidator<Type0Container>
-
checkCMapEncoding
protected void checkCMapEncoding(COSBase encoding)
-
processCMapAsStream
private void processCMapAsStream(COSStream aCMap)
This method checks mandatory fields of the CMap stream. This method also checks if the CMap stream is damaged using the CMapParser of the fontbox api. The standard information of a stream element will be checked by the StreamValidationProcess.- Parameters:
aCMap
- the cmap stream.
-
checkCIDSystemInfo
protected boolean checkCIDSystemInfo(COSBase sysinfo)
Check the content of the CIDSystemInfo dictionary. A CIDSystemInfo dictionary must contain :- a Name - Registry
- a Name - Ordering
- a Integer - Supplement
- Parameters:
sysinfo
-- Returns:
- the validation result.
-
compareCIDSystemInfo
private void compareCIDSystemInfo(COSDictionary cmap)
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.- Parameters:
cmap
-
-
-