Package com.itextpdf.io.font
Class CMapEncoding
java.lang.Object
com.itextpdf.io.font.CMapEncoding
Class representing CMap encoding in pdf document.
-
Constructor Summary
ConstructorsConstructorDescriptionCMapEncoding(String cmap) Creates a new CMap encoding.CMapEncoding(String cmap, byte[] cmapBytes) Creates a new CMap encoding.CMapEncoding(String cmap, String uniMap) Creates a new CMap encoding. -
Method Summary
Modifier and TypeMethodDescriptionintfillCmapBytes(int cid, byte[] array, int offset) Encodes a CID into the supplied byte array.voidfillCmapBytes(int cid, ByteBuffer buffer) Appends the encoded form of a CID to a byte buffer.intgetCidCode(int cmapCode) Converts a CMap code to its CID.byte[]getCmapBytes(int cid) Gets CMap bytes by CID.intgetCmapBytesLength(int cid) Gets the number of bytes required to encode a CID.Gets CMap name.Gets the CMap code space ranges.Gets string that uniquely names the character collection within the specified registry.Gets string identifying the issuer of the character collection.intGets the supplement number of the character collectionGets CMap name which converts Unicode value to CID.booleanChecks if CMap to convert Unicode value to CID is present.booleanisBuiltWith(String cmap) Checks whether theCMapEncodingwas built with corresponding cmap name.booleanisDirect()Checks if CMap is direct or indirect pdf object
-
Constructor Details
-
CMapEncoding
Creates a new CMap encoding.- Parameters:
-
cmap- CMap name
-
CMapEncoding
Creates a new CMap encoding.- Parameters:
-
cmap- CMap name -
uniMap- CMap to convert Unicode value to CID
-
CMapEncoding
Creates a new CMap encoding.- Parameters:
-
cmap- CMap name -
cmapBytes- CMap binary data
-
-
Method Details
-
isDirect
public boolean isDirect()Checks if CMap is direct or indirect pdf object- Returns:
-
trueif direct,falseotherwise
-
hasUniMap
public boolean hasUniMap()Checks if CMap to convert Unicode value to CID is present.- Returns:
-
trueif present,falseotherwise
-
getRegistry
Gets string identifying the issuer of the character collection.- Returns:
- name of the issuer
-
getOrdering
Gets string that uniquely names the character collection within the specified registry.- Returns:
- character collection name
-
getSupplement
public int getSupplement()Gets the supplement number of the character collection- Returns:
- supplement number
-
getUniMapName
Gets CMap name which converts Unicode value to CID.- Returns:
- CMap name
-
getCmapName
Gets CMap name.- Returns:
- CMap name
-
isBuiltWith
Checks whether theCMapEncodingwas built with corresponding cmap name.- Parameters:
-
cmap- a CMAP - Returns:
-
true, if the CMapEncoding was built with the cmap,falseotherwise.
-
getCmapBytes
public byte[] getCmapBytes(int cid) Gets CMap bytes by CID.- Parameters:
-
cid- id of the CMap - Returns:
- cmap as byte array
-
fillCmapBytes
public int fillCmapBytes(int cid, byte[] array, int offset) Encodes a CID into the supplied byte array.- Parameters:
-
cid- character identifier to encode -
array- destination array -
offset- destination offset - Returns:
- new destination offset
-
fillCmapBytes
Appends the encoded form of a CID to a byte buffer.- Parameters:
-
cid- character identifier to encode -
buffer- destination buffer
-
getCmapBytesLength
public int getCmapBytesLength(int cid) Gets the number of bytes required to encode a CID.- Parameters:
-
cid- character identifier to encode - Returns:
- number of bytes required to encode a CID
-
getCidCode
public int getCidCode(int cmapCode) Converts a CMap code to its CID.- Parameters:
-
cmapCode- CMap code - Returns:
- mapped CID
-
getCodeSpaceRanges
Gets the CMap code space ranges.- Returns:
- list of low/high byte array pairs used by this encoding
-