Package com.itextpdf.io.font.cmap
Class CMapToUnicode
java.lang.Object
com.itextpdf.io.font.cmap.AbstractCMap
com.itextpdf.io.font.cmap.CMapToUnicode
This class represents a CMap file.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.itextpdf.io.util.IntHashtableCreates a mapping for single-character Unicode entries.Creates a reverse mapping for single-character Unicode entries.static CMapToUnicodecreateToUnicodeCmap(FontEncoding fontEncoding) Creates a ToUnicode CMap from the given font encoding.getCodes()Returns the mapped character codes.Returns a list containing sequential pairs of code space beginning and endings: (begincodespacerange1, endcodespacerange1, begincodespacerange2, endcodespacerange1, ...)static CMapToUnicodeCreates a two-byte identity ToUnicode CMap.booleanThis will tell if this cmap has any two byte mappings.char[]lookup(byte[] code) Looks up a one- or two-byte character code.char[]lookup(byte[] code, int offset, int length) This will perform a lookup into the map.char[]lookup(int code) Looks up an integer character code.Methods inherited from class com.itextpdf.io.font.cmap.AbstractCMap
decodeStringToByte, getName, getOrdering, getRegistry, getSupplement, toUnicodeString
-
Field Details
-
EMPTY_CMAP
-
-
Constructor Details
-
CMapToUnicode
public CMapToUnicode()Creates a new instance of CMap.
-
-
Method Details
-
getIdentity
Creates a two-byte identity ToUnicode CMap.- Returns:
-
a new map that maps character codes from
0through65536to themselves
-
createToUnicodeCmap
Creates a ToUnicode CMap from the given font encoding.- Parameters:
-
fontEncoding- the font encoding - Returns:
- the ToUnicode CMap
-
hasByteMappings
public boolean hasByteMappings()This will tell if this cmap has any two byte mappings.- Returns:
-
trueIf there are any two byte mappings,falseotherwise
-
lookup
public char[] lookup(byte[] code, int offset, int length) This will perform a lookup into the map.- Parameters:
-
code- the code used to lookup -
offset- the offset into the byte array -
length- the length of the data we are getting - Returns:
- the string that matches the lookup
-
lookup
public char[] lookup(byte[] code) Looks up a one- or two-byte character code.- Parameters:
-
code- the complete character-code byte sequence - Returns:
-
the retained Unicode character array, or
nullwhen no mapping exists
-
lookup
public char[] lookup(int code) Looks up an integer character code.- Parameters:
-
code- the one- or two-byte character code represented as an integer - Returns:
-
the retained Unicode character array, or
nullwhen no mapping exists
-
getCodes
Returns the mapped character codes.- Returns:
- a live view of this map's character-code keys
-
createDirectMapping
public com.itextpdf.io.util.IntHashtable createDirectMapping()Creates a mapping for single-character Unicode entries.- Returns:
- a new map from character code to Unicode scalar value
-
createReverseMapping
Creates a reverse mapping for single-character Unicode entries.- Returns:
- a new map from Unicode scalar value to character code
-
getCodeSpaceRanges
Returns a list containing sequential pairs of code space beginning and endings: (begincodespacerange1, endcodespacerange1, begincodespacerange2, endcodespacerange1, ...)- Returns:
-
list of
byte[]that contain code space ranges
-