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
public class PDCIDFont extends PDFont
Class represents CIDFont on PD level.- Author:
- Sergey Shemyakov
-
-
Field Summary
Fields Modifier and Type Field Description protected CMap
cMap
-
Fields inherited from class org.verapdf.pd.font.PDFont
boundingBox, dictionary, encoding, fontDescriptor, fontProgram, isFontParsed, toUnicodeCMap
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description COSStream
getCIDSet()
PDCIDSystemInfo
getCIDSystemInfo()
COSObject
getCIDToGIDMap()
Double
getDefaultWidth()
FontProgram
getFontProgram()
Double
getWidth(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, getObject, getRealKey, getStringKey, knownKey, removeKey, setBooleanKey, setIntegerKey, setKey, setNameKey, setObject, setObject, setStringKey, updateFromObject, updateToObject
-
-
-
-
Field Detail
-
cMap
protected CMap cMap
-
-
Constructor Detail
-
PDCIDFont
public PDCIDFont(COSDictionary dictionary, CMap cMap)
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
protected PDCIDFont(COSDictionary dictionary)
-
-
Method Detail
-
getCIDSet
public COSStream getCIDSet()
- Returns:
- a stream identifying which CIDs are present in the CIDFont file.
-
getCIDToGIDMap
public COSObject getCIDToGIDMap()
- Returns:
- a specification of the mapping from CIDs to glyph indices if CIDFont is a Type 2 CIDFont.
-
getWidth
public Double getWidth(int code)
Gets width for glyph with given code in this font.
-
getDefaultWidth
public Double getDefaultWidth()
- Overrides:
getDefaultWidth
in classPDFont
- Returns:
- default width for this font as specified in font descriptor.
-
readCode
public int readCode(InputStream stream) throws IOException
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
public FontProgram 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
public PDCIDSystemInfo getCIDSystemInfo()
- Returns:
- CID System Info object for this CIDFont.
-
-