Top Fields Constructors Methods
org.apache.pdfbox.preflight.font.container

public abstract Class FontContainer<T extends PDFontLike>

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.pdfbox.preflight.font.container.TrueTypeContainer, org.apache.pdfbox.preflight.font.container.Type0Container, org.apache.pdfbox.preflight.font.container.Type1Container, org.apache.pdfbox.preflight.font.container.Type3Container, org.apache.pdfbox.preflight.font.container.CIDType0Container, org.apache.pdfbox.preflight.font.container.CIDType2Container
Imports
java.io.IOException, java.util.ArrayList, .HashMap, .List, .Map, org.apache.pdfbox.pdmodel.font.PDFontLike, org.apache.pdfbox.preflight.PreflightConstants, .ValidationResult.ValidationError, org.apache.pdfbox.preflight.font.util.GlyphDetail, .GlyphException

Field Summary

Modifier and TypeField and Description
private final Map<Integer, GlyphDetail>
protected boolean
embeddedFont

Boolean used to known if the font is embedded.

protected final List<ValidationResult.ValidationError>
errorBuffer

List of validation errors that occur during the font validation.

private boolean
protected final T
font

Font-like object.

Constructor Summary

AccessConstructor and Description
public
FontContainer(T font)

Method Summary

Modifier and TypeMethod and Description
public void
checkGlyphWidth(int
character code
code
)

Check that the Width or W entry in the PDF matches the widths in the embedded font program.

private void
checkWidthsConsistency(int
character code
code
,
float
expected with given in the PDF file
expectedWidth
,
float
the glyph width found in the font program, a negative value if the CID is missing from the font.
foundWidth
)

Test if both widths are consistent.

public boolean
public List<ValidationResult.ValidationError>
protected abstract boolean
hasGlyph(int
character code
code
)

Checks if the embedded font contains a glyph for the given character code.

private boolean

Returns:

true if the CID has previously been marked as valid, false otherwise
isAlreadyProcessed
(int
character code
code
)

Check if the given character code has already been processed.

public boolean
public boolean
public final void
public final void
markAsValid(int code)

public void
public void
public void
public void
setErrorsAlreadyMerged(boolean errorsAlreadyMerged)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

codeToDetailback to summary
private final Map<Integer, GlyphDetail> codeToDetail
embeddedFontback to summary
protected boolean embeddedFont

Boolean used to known if the font is embedded.

errorBufferback to summary
protected final List<ValidationResult.ValidationError> 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.

errorsAlreadyMergedback to summary
private boolean errorsAlreadyMerged
fontback to summary
protected final T font

Font-like object.

Constructor Detail

FontContainerback to summary
public FontContainer(T font)

Method Detail

checkGlyphWidthback to summary
public void checkGlyphWidth(int code) throws GlyphException

Check that the Width or W entry in the PDF matches the widths in the embedded font program.

Parameters
code:int

character code

checkWidthsConsistencyback to summary
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:int

character code

expectedWidth:float

expected with given in the PDF file

foundWidth:float

the glyph width found in the font program, a negative value if the CID is missing from the font.

Exceptions
GlyphException:
the appropriate exception if the CID is invalid.
errorsAleadyMergedback to summary
public boolean errorsAleadyMerged()
getAllErrorsback to summary
public List<ValidationResult.ValidationError> getAllErrors()
hasGlyphback to summary
protected abstract boolean hasGlyph(int code) throws IOException

Checks if the embedded font contains a glyph for the given character code.

Parameters
code:int

character code

isAlreadyProcessedback to summary
private boolean isAlreadyProcessed(int code) throws GlyphException

Check if the given character code has already been processed.

Parameters
code:int

character code

Returns:boolean

true if the CID has previously been marked as valid, false otherwise

Exceptions
GlyphException:
if the code has previously been marked as invalid // TODO useful ??
isEmbeddedFontback to summary
public boolean isEmbeddedFont()
isValidback to summary
public boolean isValid()
markAsInvalidback to summary
public final void markAsInvalid(int code, GlyphException e)
markAsValidback to summary
public final void markAsValid(int code)
notEmbeddedback to summary
public void notEmbedded()
pushback to summary
public void push(ValidationResult.ValidationError error)
pushback to summary
public void push(List<ValidationResult.ValidationError> errors)
setErrorsAlreadyMergedback to summary
public void setErrorsAlreadyMerged(boolean errorsAlreadyMerged)