Package org.verapdf.pd.font.truetype
Class CIDFontType2Program
- java.lang.Object
-
- org.verapdf.pd.font.truetype.BaseTrueTypeProgram
-
- org.verapdf.pd.font.truetype.CIDFontType2Program
-
- All Implemented Interfaces:
FontProgram
public class CIDFontType2Program extends BaseTrueTypeProgram implements FontProgram
Represents CIDFontType2 font program.- Author:
- Sergey Shemyakov
-
-
Field Summary
-
Fields inherited from class org.verapdf.pd.font.truetype.BaseTrueTypeProgram
encodingMappingArray, parser, widths
-
-
Constructor Summary
Constructors Constructor Description CIDFontType2Program(ASInputStream stream, CMap cMap, COSObject cidToGID)Constructor from font stream and encoding details.
-
Method Summary
All Methods Instance Methods Concrete 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.List<Integer>getCIDList()StringgetGlyphName(int code)Returns glyph name for glyph with given code.floatgetWidth(int code)Returns width of glyph for given character code.floatgetWidth(String glyphName)Returns width of glyph for given glyph name.-
Methods inherited from class org.verapdf.pd.font.truetype.BaseTrueTypeProgram
getAscent, getDescent, getFontProgramResource, getNGlyphs, getNrOfCMaps, getWeight, getWidthWithCheck, isAttemptedParsing, isCmapPresent, isSuccessfulParsing, parseFont
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.verapdf.pd.font.FontProgram
getAscent, getDescent, getFontProgramResource, getWeight, isAttemptedParsing, isSuccessfulParsing, parseFont
-
-
-
-
Constructor Detail
-
CIDFontType2Program
public CIDFontType2Program(ASInputStream stream, CMap cMap, COSObject cidToGID) throws IOException
Constructor from font stream and encoding details.- Parameters:
stream-cMap-cidToGID-- Throws:
IOException
-
-
Method Detail
-
getWidth
public float getWidth(int code)
Returns width of glyph for given character code.- Specified by:
getWidthin interfaceFontProgram- Parameters:
code- is code for glyph.- Returns:
- width of corresponding glyph or -1 if glyph is not found.
-
getWidth
public float getWidth(String glyphName)
Returns 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.
-
containsCode
public boolean containsCode(int code)
Checks 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
public boolean containsGlyph(String glyphName)
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.
-
getGlyphName
public String getGlyphName(int code)
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.
-
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.
-
-