public abstract class FontContainer<T extends PDFontLike>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Integer,GlyphDetail> |
codeToDetail |
protected boolean |
embeddedFont
Boolean used to known if the font is embedded.
|
protected java.util.List<ValidationResult.ValidationError> |
errorBuffer
List of validation errors that occur during the font validation.
|
private boolean |
errorsAlreadyMerged |
protected T |
font
Font-like object.
|
Constructor and Description |
---|
FontContainer(T font) |
Modifier and Type | Method and Description |
---|---|
void |
checkGlyphWidth(int code)
Check that the Width or W entry in the PDF matches the widths in the embedded font program.
|
private void |
checkWidthsConsistency(int code,
float expectedWidth,
float foundWidth)
Test if both widths are consistent.
|
boolean |
errorsAleadyMerged() |
java.util.List<ValidationResult.ValidationError> |
getAllErrors() |
protected abstract boolean |
hasGlyph(int code)
Checks if the embedded font contains a glyph for the given character code.
|
private boolean |
isAlreadyProcessed(int code)
Check if the given character code has already been processed.
|
boolean |
isEmbeddedFont() |
boolean |
isValid() |
void |
markAsInvalid(int code,
GlyphException e) |
void |
markAsValid(int code) |
void |
notEmbedded() |
void |
push(java.util.List<ValidationResult.ValidationError> errors) |
void |
push(ValidationResult.ValidationError error) |
void |
setErrorsAlreadyMerged(boolean errorsAlreadyMerged) |
protected java.util.List<ValidationResult.ValidationError> errorBuffer
protected boolean embeddedFont
private final java.util.Map<java.lang.Integer,GlyphDetail> codeToDetail
private boolean errorsAlreadyMerged
protected final T extends PDFontLike font
public FontContainer(T font)
public void push(ValidationResult.ValidationError error)
public void push(java.util.List<ValidationResult.ValidationError> errors)
public java.util.List<ValidationResult.ValidationError> getAllErrors()
public boolean isValid()
public boolean errorsAleadyMerged()
public void setErrorsAlreadyMerged(boolean errorsAlreadyMerged)
public boolean isEmbeddedFont()
public void notEmbedded()
public void checkGlyphWidth(int code) throws GlyphException
code
- character codeGlyphException
protected abstract boolean hasGlyph(int code) throws java.io.IOException
code
- character codejava.io.IOException
private boolean isAlreadyProcessed(int code) throws GlyphException
code
- character codeGlyphException
- if the code has previously been marked as invalid // TODO useful ??private void checkWidthsConsistency(int code, float expectedWidth, float foundWidth) throws GlyphException
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.GlyphException
- the appropriate exception if the CID is invalid.public final void markAsValid(int code)
public final void markAsInvalid(int code, GlyphException e)