Package org.apache.pdfbox.preflight.font
Class Type3FontValidator
java.lang.Object
org.apache.pdfbox.preflight.font.FontValidator<Type3Container>
org.apache.pdfbox.preflight.font.Type3FontValidator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected COSDocument
protected PDType3Font
protected COSDictionary
Fields inherited from class org.apache.pdfbox.preflight.font.FontValidator
context, descriptorHelper, fontContainer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
CharProcs is a dictionary where the key is a character name and the value is a Stream which contains the glyph representation of the key.protected void
For a Type3 font, the mapping between the Character Code and the Character name is entirely defined in the /Encoding entry.private void
checkEncodingAsDictionary
(COSDictionary encodingDictionary) This method is called by the CheckEncoding method if the /Encoding entry is an instance of COSDictionary.private void
This method is called by the CheckEncoding method if the /Encoding entry is a String.private void
Check that the FontBBox element has the right format as declared in the PDF reference document.private void
Check that the FontMatrix element has the right format as declared in the PDF reference document.protected void
private void
If the Resources entry is present, this method checks its content.private PDType3CharProc
getCharProc
(int code) private float
getWidthFromCharProc
(PDType3CharProc charProc) Parse the Glyph description to obtain the Widthvoid
validate()
Methods inherited from class org.apache.pdfbox.preflight.font.FontValidator
checkToUnicode, getFontContainer
-
Field Details
-
font
-
fontDictionary
-
cosDocument
-
-
Constructor Details
-
Type3FontValidator
-
-
Method Details
-
validate
- Specified by:
validate
in classFontValidator<Type3Container>
- Throws:
ValidationException
-
checkMandatoryField
protected void checkMandatoryField() -
checkFontBBox
private void checkFontBBox()Check that the FontBBox element has the right format as declared in the PDF reference document. -
checkFontMatrix
private void checkFontMatrix()Check that the FontMatrix element has the right format as declared in the PDF reference document. -
checkEncoding
protected void checkEncoding()For a Type3 font, the mapping between the Character Code and the Character name is entirely defined in the /Encoding entry. The /Encoding Entry can be a Name (For the 5 predefined encodings) or a dictionary. If it is a dictionary, the /Differences array contains the correspondence between a character code and a set of character name which are different from the encoding entry of the dictionary. This method checks that the encoding is :- An existing encoding name.
- A dictionary with an existing encoding name (the name is optional) and a well formed "Differences" array (the array is optional)
- Overrides:
checkEncoding
in classFontValidator<Type3Container>
-
checkEncodingAsString
This method is called by the CheckEncoding method if the /Encoding entry is a String. In this case, the String must be an existing encoding name. (WinAnsi, MacRoman...)- Parameters:
enc
- The name of the encoding.
-
checkEncodingAsDictionary
This method is called by the CheckEncoding method if the /Encoding entry is an instance of COSDictionary. If that dictionary has a /BaseEncoding entry, the name is checked. In any case, the /Differences array is validated.- Parameters:
encodingDictionary
- the encoding dictionary.
-
checkCharProcsAndMetrics
private void checkCharProcsAndMetrics()CharProcs is a dictionary where the key is a character name and the value is a Stream which contains the glyph representation of the key. This method checks that all characters codes defined in the Widths Array exist in the CharProcs dictionary. If the CharProcs doesn't know the Character, it is mapped with the .notdef one. For each character, the Glyph width must be the same as the Width value declared in the Widths array. -
getWidths
-
getCharProc
-
getWidthFromCharProc
Parse the Glyph description to obtain the Width- Returns:
- the width of the character
- Throws:
IOException
-
checkResources
If the Resources entry is present, this method checks its content. Only fonts and images are checked because this resource describes glyphs.- Throws:
ValidationException
-