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
Fields inherited from class org.verapdf.pd.font.PDFont
boundingBox, dictionary, encoding, fontDescriptor, fontProgram, isFontParsed, toUnicodeCMap
-
Constructor Summary
ModifierConstructorDescriptionprotected
PDCIDFont
(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.float
getWidthFromProgram
(int code) Gets width of given code from font program.boolean
glyphIsPresent
(int code) Checks if glyph for given code is present in this font.int
readCode
(InputStream stream) Method reads next character code from stream according to font data.Methods inherited from class org.verapdf.pd.font.PDFont
cMapToUnicode, getAscent, getBoundingBox, getDescent, getDictionary, getDifferences, getDifferencesFromCosEncoding, getEncoding, getEncodingMapping, getFirstChar, getFontDescriptor, getFontWeight, getLastChar, getName, getNameWithoutSubset, getProgramSubtype, getSubtype, getType, getWidths, isSubset, isSuccessfullyParsed, isSymbolic, setSuccessfullyParsed, toUnicode
Methods inherited from class org.verapdf.pd.PDResource
isInherited, setInherited
Methods 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:
getDefaultWidth
in 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:
readCode
in classPDFont
- Parameters:
stream
- is stream with raw data.- Returns:
- next character code read.
- Throws:
IOException
- if reading fails.
-
getFontProgram
- Specified by:
getFontProgram
in classPDFont
- Returns:
- embedded font program fo this PDFont.
-
getWidthFromProgram
public float getWidthFromProgram(int code) Description copied from class:PDFont
Gets width of given code from font program.- Specified by:
getWidthFromProgram
in 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:PDFont
Checks if glyph for given code is present in this font.- Specified by:
glyphIsPresent
in 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.
-