Package org.verapdf.pd.font.type1
Class Type1FontProgram
java.lang.Object
org.verapdf.parser.COSParser
org.verapdf.parser.NotSeekableCOSParser
org.verapdf.parser.postscript.PSParser
org.verapdf.pd.font.type1.Type1FontProgram
- All Implemented Interfaces:
Closeable,AutoCloseable,FontProgram
This class does parsing of Type 1 font files.
- Author:
- Sergey Shemyakov
-
Field Summary
FieldsFields inherited from class org.verapdf.parser.postscript.PSParser
operandStack, userDict -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsCID(int cid) Method works only for fonts where cid notation is used.booleancontainsCode(int code) Checks if font contains character with given code.booleancontainsGlyph(String glyphName) Checks if this font program has glyph for given glyph name.String[]getGlyphName(int code) Returns glyph name for glyph with given code.floatgetWidth(int charCode) Returns width of glyph for given character code.floatReturns width of glyph for given glyph name.booleanbooleanvoidThis method is entry point for parsing process.protected voidMethods inherited from class org.verapdf.parser.postscript.PSParser
getCloseDictionary, getDictionary, getObjectFromUserDictMethods inherited from class org.verapdf.parser.NotSeekableCOSParser
close, getBaseParser, getSourceMethods inherited from class org.verapdf.parser.COSParser
decryptCOSString, getArray, getErrorMessage, getName, nextObject
-
Field Details
-
LOGGER
-
OPERATORS_KEYWORDS
-
-
Constructor Details
-
Type1FontProgram
- Throws:
IOException
-
-
Method Details
-
parseFont
This method is entry point for parsing process.- Specified by:
parseFontin interfaceFontProgram- Throws:
IOException- if stream reading error occurs.
-
getWidth
public float getWidth(int charCode) Description copied from interface:FontProgramReturns width of glyph for given character code.- Specified by:
getWidthin interfaceFontProgram- Parameters:
charCode- is code for glyph.- Returns:
- width of corresponding glyph or -1 if glyph is not found.
-
getWidth
Description copied from interface:FontProgramReturns width of glyph for given glyph name.- Specified by:
getWidthin interfaceFontProgram- Parameters:
glyphName- is name for glyph.- Returns:
- width of corresponding glyph or -1 if glyph is not found.
-
skipSpacesExceptNullByte
- Throws:
IOException
-
containsCode
public boolean containsCode(int code) Description copied from interface:FontProgramChecks if font contains character with given code.- Specified by:
containsCodein interfaceFontProgram- Parameters:
code- is character code.- Returns:
- true if font contains character with given code.
-
containsGlyph
Description copied from interface:FontProgramChecks if this font program has glyph for given glyph name.- Specified by:
containsGlyphin interfaceFontProgram- Parameters:
glyphName- is the name of glyph.- Returns:
- true if this font program has glyph for given name.
-
containsCID
public boolean containsCID(int cid) Description copied from interface:FontProgramMethod works only for fonts where cid notation is used.- Specified by:
containsCIDin interfaceFontProgram- Returns:
- true if font a is cid font and contains given cid.
-
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.
-
getEncoding
- Returns:
- encoding from embedded font program as array of strings. encoding[i] = glyphName <-> i has name glyphName.
-
getCharSet
- Returns:
- charset from embedded program, i.e. set of all glyph names defined in the embedded font program.
-
getGlyphName
Description copied from interface:FontProgramReturns glyph name for glyph with given code.- Specified by:
getGlyphNamein interfaceFontProgram- Parameters:
code- is code of glyph.- Returns:
- glyph name.
-
getFontProgramResource
- Specified by:
getFontProgramResourcein interfaceFontProgram- Returns:
- the closeable object that closes source stream of this font program.
-
getWeight
- Specified by:
getWeightin interfaceFontProgram
-
getAscent
- Specified by:
getAscentin interfaceFontProgram
-
getDescent
- Specified by:
getDescentin interfaceFontProgram
-
getCIDList
- Specified by:
getCIDListin interfaceFontProgram
-