Class FontContainer<T extends PDFontLike>
java.lang.Object
org.apache.pdfbox.preflight.font.container.FontContainer<T>
- Direct Known Subclasses:
CIDType0Container,CIDType2Container,TrueTypeContainer,Type0Container,Type1Container,Type3Container
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Integer,GlyphDetail> protected booleanBoolean used to known if the font is embedded.protected List<ValidationResult.ValidationError>List of validation errors that occur during the font validation.private booleanprotected final TFont-like object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckGlyphWidth(int code) Check that the Width or W entry in the PDF matches the widths in the embedded font program.private voidcheckWidthsConsistency(int code, float expectedWidth, float foundWidth) Test if both widths are consistent.booleanprotected abstract booleanhasGlyph(int code) Checks if the embedded font contains a glyph for the given character code.private booleanisAlreadyProcessed(int code) Check if the given character code has already been processed.booleanbooleanisValid()final voidmarkAsInvalid(int code, GlyphException e) final voidmarkAsValid(int code) voidvoidpush(List<ValidationResult.ValidationError> errors) voidvoidsetErrorsAlreadyMerged(boolean errorsAlreadyMerged)
-
Field Details
-
errorBuffer
List of validation errors that occur during the font validation. If the font is used by an object in the PDF, all these errors will be appended to the Error list of the PreflightContext. -
embeddedFont
protected boolean embeddedFontBoolean used to known if the font is embedded. -
codeToDetail
-
errorsAlreadyMerged
private boolean errorsAlreadyMerged -
font
Font-like object.
-
-
Constructor Details
-
FontContainer
-
-
Method Details
-
push
-
push
-
getAllErrors
-
isValid
public boolean isValid() -
errorsAleadyMerged
public boolean errorsAleadyMerged() -
setErrorsAlreadyMerged
public void setErrorsAlreadyMerged(boolean errorsAlreadyMerged) -
isEmbeddedFont
public boolean isEmbeddedFont() -
notEmbedded
public void notEmbedded() -
checkGlyphWidth
Check that the Width or W entry in the PDF matches the widths in the embedded font program.- Parameters:
code- character code- Throws:
GlyphException
-
hasGlyph
Checks if the embedded font contains a glyph for the given character code.- Parameters:
code- character code- Throws:
IOException
-
isAlreadyProcessed
Check if the given character code has already been processed.- Parameters:
code- character code- Returns:
- true if the CID has previously been marked as valid, false otherwise
- Throws:
GlyphException- if the code has previously been marked as invalid // TODO useful ??
-
checkWidthsConsistency
private void checkWidthsConsistency(int code, float expectedWidth, float foundWidth) throws GlyphException Test if both widths are consistent. At the end of this method, the CID is marked as valid or invalid.- Parameters:
code- character codeexpectedWidth- expected with given in the PDF filefoundWidth- the glyph width found in the font program, a negative value if the CID is missing from the font.- Throws:
GlyphException- the appropriate exception if the CID is invalid.
-
markAsValid
public final void markAsValid(int code) -
markAsInvalid
-