Package org.verapdf.pd.font
Interface FontProgram
-
- All Known Implementing Classes:
BaseTrueTypeProgram,CFFCIDFontProgram,CFFFontProgram,CFFType1FontProgram,CIDFontType2Program,OpenTypeFontProgram,TrueTypeFontProgram,Type1FontProgram
public interface FontProgramInterface for all fonts in pdflib.- Author:
- Sergey Shemyakov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontainsCID(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.DoublegetAscent()DoublegetDescent()ASFileStreamClosergetFontProgramResource()StringgetGlyphName(int code)Returns glyph name for glyph with given code.StringgetWeight()floatgetWidth(int code)Returns width of glyph for given character code.floatgetWidth(String glyphName)Returns width of glyph for given glyph name.booleanisAttemptedParsing()booleanisSuccessfulParsing()voidparseFont()This method does parsing of font, after it all the data needed should be extracted.
-
-
-
Method Detail
-
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
float getWidth(String glyphName)
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
void parseFont() throws IOExceptionThis 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
boolean containsGlyph(String glyphName)
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
String getGlyphName(int code)
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()
-
-