Package org.verapdf.pd.font.truetype
Class BaseTrueTypeProgram
java.lang.Object
org.verapdf.pd.font.truetype.BaseTrueTypeProgram
- All Implemented Interfaces:
FontProgram
- Direct Known Subclasses:
CIDFontType2Program,TrueTypeFontProgram
Base class for TrueTypeFontProgram and CIDFontType2Program.
- Author:
- Sergey Shemyakov
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]protected org.verapdf.pd.font.truetype.TrueTypeFontParserprotected float[] -
Constructor Summary
ConstructorsConstructorDescriptionBaseTrueTypeProgram(ASInputStream stream) Constructor from stream containing font data, and encoding details. -
Method Summary
Modifier and TypeMethodDescriptionintintprotected floatgetWidthWithCheck(int gid) booleanbooleanisCmapPresent(int platformID, int encodingID) Returns true if cmap table with given platform ID and encoding ID is present in the font.booleanvoidParses True Type font from given stream and extracts all the data needed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.verapdf.pd.font.FontProgram
containsCID, containsCode, containsGlyph, getCIDList, getGlyphName, getWidth, getWidth
-
Field Details
-
widths
protected float[] widths -
parser
protected org.verapdf.pd.font.truetype.TrueTypeFontParser parser -
encodingMappingArray
-
-
Constructor Details
-
BaseTrueTypeProgram
Constructor from stream containing font data, and encoding details.- Parameters:
stream- is stream containing font data.- Throws:
IOException- if creation of @{link SeekableStream} fails.
-
-
Method Details
-
parseFont
Parses True Type font from given stream and extracts all the data needed.- Specified by:
parseFontin interfaceFontProgram- Throws:
IOException- if stream-reading error occurs.
-
getNrOfCMaps
public int getNrOfCMaps()- Returns:
- array, containing platform ID and encoding ID for each cmap in this True Type font.
-
getNGlyphs
public int getNGlyphs()- Returns:
- number of glyphs in this font.
-
isCmapPresent
public boolean isCmapPresent(int platformID, int encodingID) Returns true if cmap table with given platform ID and encoding ID is present in the font.- Parameters:
platformID- is platform ID of requested cmap.encodingID- is encoding ID of requested cmap.- Returns:
- true if requested cmap is present.
-
getWidthWithCheck
protected float getWidthWithCheck(int gid) -
isAttemptedParsing
public boolean isAttemptedParsing()- Specified by:
isAttemptedParsingin interfaceFontProgram- Returns:
- true if font parsing has been attempted.
-
isSuccessfulParsing
public boolean isSuccessfulParsing()- Specified by:
isSuccessfulParsingin interfaceFontProgram- Returns:
- true if font was successfully parsed.
-
getFontProgramResource
- Specified by:
getFontProgramResourcein interfaceFontProgram- Returns:
- file stream closer that handles the closing of font program stream or null if stream is memory stream.
-
getWeight
- Specified by:
getWeightin interfaceFontProgram
-
getAscent
- Specified by:
getAscentin interfaceFontProgram
-
getDescent
- Specified by:
getDescentin interfaceFontProgram
-