Package com.itextpdf.io.font.cmap
Class CMapToUnicode
- java.lang.Object
-
- com.itextpdf.io.font.cmap.AbstractCMap
-
- com.itextpdf.io.font.cmap.CMapToUnicode
-
public class CMapToUnicode extends AbstractCMap
This class represents a CMap file.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,char[]>
byteMappings
private java.util.List<byte[]>
codeSpaceRanges
static CMapToUnicode
EmptyCMapToUnicodeMap
-
Constructor Summary
Constructors Modifier Constructor Description CMapToUnicode()
Creates a new instance of CMap.private
CMapToUnicode(boolean emptyCMap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addChar(int cid, char[] uni)
(package private) void
addChar(java.lang.String mark, CMapObject code)
(package private) void
addCodeSpaceRange(byte[] low, byte[] high)
private int
convertToInt(char[] s)
private char[]
createCharsFromDoubleBytes(byte[] bytes)
private char[]
createCharsFromSingleBytes(byte[] bytes)
IntHashtable
createDirectMapping()
java.util.Map<java.lang.Integer,java.lang.Integer>
createReverseMapping()
java.util.Set<java.lang.Integer>
getCodes()
java.util.List<byte[]>
getCodeSpaceRanges()
Returns a list containing sequential pairs of code space beginning and endings: (begincodespacerange1, endcodespacerange1, begincodespacerange2, endcodespacerange1, ...)static CMapToUnicode
getIdentity()
boolean
hasByteMappings()
This will tell if this cmap has any two byte mappings.char[]
lookup(byte[] code)
char[]
lookup(byte[] code, int offset, int length)
This will perform a lookup into the map.char[]
lookup(int code)
-
Methods inherited from class com.itextpdf.io.font.cmap.AbstractCMap
addRange, decodeStringToByte, getName, getOrdering, getRegistry, getSupplement, setName, setOrdering, setRegistry, setSupplement, toUnicodeString
-
-
-
-
Field Detail
-
EmptyCMapToUnicodeMap
public static CMapToUnicode EmptyCMapToUnicodeMap
-
byteMappings
private final java.util.Map<java.lang.Integer,char[]> byteMappings
-
codeSpaceRanges
private final java.util.List<byte[]> codeSpaceRanges
-
-
Method Detail
-
getIdentity
public static CMapToUnicode getIdentity()
-
hasByteMappings
public boolean hasByteMappings()
This will tell if this cmap has any two byte mappings.- Returns:
- true If there are any two byte mappings, false otherwise.
-
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)
-
lookup
public char[] lookup(int code)
-
getCodes
public java.util.Set<java.lang.Integer> getCodes()
-
createDirectMapping
public IntHashtable createDirectMapping()
-
createReverseMapping
public java.util.Map<java.lang.Integer,java.lang.Integer> createReverseMapping()
-
getCodeSpaceRanges
public java.util.List<byte[]> 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
-
addCodeSpaceRange
void addCodeSpaceRange(byte[] low, byte[] high)
- Overrides:
addCodeSpaceRange
in classAbstractCMap
-
convertToInt
private int convertToInt(char[] s)
-
addChar
void addChar(int cid, char[] uni)
-
addChar
void addChar(java.lang.String mark, CMapObject code)
- Specified by:
addChar
in classAbstractCMap
-
createCharsFromSingleBytes
private char[] createCharsFromSingleBytes(byte[] bytes)
-
createCharsFromDoubleBytes
private char[] createCharsFromDoubleBytes(byte[] bytes)
-
-