Package org.verapdf.pd.font
Class PDCIDFont
java.lang.Object
org.verapdf.pd.PDObject
org.verapdf.pd.PDResource
org.verapdf.pd.font.PDFont
org.verapdf.pd.font.PDCIDFont
- Direct Known Subclasses:
PDType0Font
Class represents CIDFont on PD level.
- Author:
- Sergey Shemyakov
-
Field Summary
FieldsFields inherited from class org.verapdf.pd.font.PDFont
boundingBox, dictionary, encoding, fontDescriptor, fontProgram, isFontParsed, toUnicodeCMap -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPDCIDFont(COSDictionary dictionary) PDCIDFont(COSDictionary dictionary, CMap cMap) Constructor from COSDictionary and CMap with code -> cid mapping.PDCIDFont(COSDictionary dictionary, CMap cMap, FontProgram fontProgram, boolean isFontParsed) Constructor that sets font program for this CIDFont. -
Method Summary
Modifier and TypeMethodDescriptiongetWidth(int code) Gets width for glyph with given code in this font.floatgetWidthFromProgram(int code) Gets width of given code from font program.booleanglyphIsPresent(int code) Checks if glyph for given code is present in this font.intreadCode(InputStream stream) Method reads next character code from stream according to font data.Methods inherited from class org.verapdf.pd.font.PDFont
calculateEncodingMapping, cMapToUnicode, getAscent, getBoundingBox, getDescent, getDictionary, getDifferences, getDifferencesFromCosEncoding, getEncoding, getEncodingMapping, getFirstChar, getFontDescriptor, getFontWeight, getLastChar, getName, getNameWithoutSubset, getProgramSubtype, getSubtype, getSubtypeEntryValue, getType, getWidths, isSubset, isSuccessfullyParsed, isSymbolic, setSuccessfullyParsed, toUnicodeMethods inherited from class org.verapdf.pd.PDResource
isInherited, setInheritedMethods inherited from class org.verapdf.pd.PDObject
clear, empty, getBooleanKey, getIntegerKey, getKey, getNameKey, getNameKeyStringValue, getObject, getRealKey, getStringKey, knownKey, removeKey, setBooleanKey, setIntegerKey, setKey, setNameKey, setObject, setObject, setStringKey, updateFromObject, updateToObject
-
Field Details
-
cMap
-
-
Constructor Details
-
PDCIDFont
Constructor from COSDictionary and CMap with code -> cid mapping.- Parameters:
dictionary- is COSDictionary of CIDFont.cMap- is CMap object containing mapping code -> cid.
-
PDCIDFont
public PDCIDFont(COSDictionary dictionary, CMap cMap, FontProgram fontProgram, boolean isFontParsed) Constructor that sets font program for this CIDFont. Can be used when font program should not be parsed twice and is already read.- Parameters:
dictionary- is COSDictionary of CIDFont.cMap- is CMap object containing mapping code -> cid.fontProgram- is embedded font program associated with this CIDFont.isFontParsed- is true if embedded font program has been already parsed.
-
PDCIDFont
-
-
Method Details
-
getCIDSet
- Returns:
- a stream identifying which CIDs are present in the CIDFont file.
-
getCIDToGIDMap
- Returns:
- a specification of the mapping from CIDs to glyph indices if CIDFont is a Type 2 CIDFont.
-
getWidth
Gets width for glyph with given code in this font. -
getDefaultWidth
- Overrides:
getDefaultWidthin classPDFont- Returns:
- default width for this font as specified in font descriptor.
-
readCode
Method reads next character code from stream according to font data. It can contain from 1 to 4 bytes.- Overrides:
readCodein classPDFont- Parameters:
stream- is stream with raw data.- Returns:
- next character code read.
- Throws:
IOException- if reading fails.
-
getFontProgram
- Specified by:
getFontProgramin classPDFont- Returns:
- embedded font program fo this PDFont.
-
getWidthFromProgram
public float getWidthFromProgram(int code) Description copied from class:PDFontGets width of given code from font program.- Specified by:
getWidthFromProgramin classPDFont- Parameters:
code- is code of character in strings to display.- Returns:
- width of glyph for this code.
-
glyphIsPresent
public boolean glyphIsPresent(int code) Description copied from class:PDFontChecks if glyph for given code is present in this font.- Specified by:
glyphIsPresentin classPDFont- Parameters:
code- is code for glyph in this font.- Returns:
- true if glyph is present.
-
getCIDSystemInfo
- Returns:
- CID System Info object for this CIDFont.
-