Package org.verapdf.pd.font
Interface FontProgram
- All Known Implementing Classes:
BaseTrueTypeProgram,CFFCIDFontProgram,CFFFontProgram,CFFType1FontProgram,CIDFontType2Program,OpenTypeFontProgram,TrueTypeFontProgram,Type1FontProgram
public interface FontProgram
Interface for all fonts in pdflib.
- Author:
- Sergey Shemyakov
-
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.getGlyphName(int code) Returns glyph name for glyph with given code.floatgetWidth(int code) Returns width of glyph for given character code.floatReturns width of glyph for given glyph name.booleanbooleanvoidThis method does parsing of font, after it all the data needed should be extracted.
-
Method Details
-
getWidth
float getWidth(int code) Returns width of glyph for given character code.- Parameters:
code- is code for glyph.- Returns:
- width of corresponding glyph or -1 if glyph is not found.
-
getWidth
Returns width of glyph for given glyph name.- Parameters:
glyphName- is name for glyph.- Returns:
- width of corresponding glyph or -1 if glyph is not found.
-
parseFont
This method does parsing of font, after it all the data needed should be extracted.- Throws:
IOException- if error in font parsing occurs.
-
containsCode
boolean containsCode(int code) Checks if font contains character with given code.- Parameters:
code- is character code.- Returns:
- true if font contains character with given code.
-
containsCID
boolean containsCID(int cid) Method works only for fonts where cid notation is used.- Returns:
- true if font a is cid font and contains given cid.
-
containsGlyph
Checks if this font program has glyph for given glyph name.- Parameters:
glyphName- is the name of glyph.- Returns:
- true if this font program has glyph for given name.
-
isAttemptedParsing
boolean isAttemptedParsing()- Returns:
- true if font parsing has been attempted.
-
isSuccessfulParsing
boolean isSuccessfulParsing()- Returns:
- true if font was successfully parsed.
-
getGlyphName
Returns glyph name for glyph with given code.- Parameters:
code- is code of glyph.- Returns:
- glyph name.
-
getFontProgramResource
ASFileStreamCloser getFontProgramResource()- Returns:
- file stream closer that handles the closing of font program stream or null if stream is memory stream.
-
getWeight
String getWeight() -
getAscent
Double getAscent() -
getDescent
Double getDescent() -
getCIDList
-