public class CMap
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Integer,java.lang.String> |
charToUnicode |
private java.lang.String |
cmapName |
private int |
cmapType |
private java.lang.String |
cmapVersion |
private java.util.List<CodespaceRange> |
codespaceRanges |
private java.util.Map<java.lang.Integer,java.lang.Integer> |
codeToCid |
private java.util.List<CIDRange> |
codeToCidRanges |
private static org.apache.commons.logging.Log |
LOG |
private int |
maxCodeLength |
private int |
minCodeLength |
private java.lang.String |
ordering |
private java.lang.String |
registry |
private static java.lang.String |
SPACE |
private int |
spaceMapping |
private int |
supplement |
private int |
wmode |
Constructor and Description |
---|
CMap()
Creates a new instance of CMap.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addCharMapping(byte[] codes,
java.lang.String unicode)
This will add a character code to Unicode character sequence mapping.
|
(package private) void |
addCIDMapping(int code,
int cid)
This will add a CID mapping.
|
(package private) void |
addCIDRange(char from,
char to,
int cid)
This will add a CID Range.
|
(package private) void |
addCodespaceRange(CodespaceRange range)
This will add a codespace range.
|
private int |
getCodeFromArray(byte[] data,
int offset,
int length)
Convert the given part of a byte array to an integer.
|
java.lang.String |
getName()
Returns the name of the CMap.
|
java.lang.String |
getOrdering()
Returns the ordering of the CIDSystemInfo.
|
java.lang.String |
getRegistry()
Returns the registry of the CIDSystemInfo.
|
int |
getSpaceMapping()
Returns the mapping for the space character.
|
int |
getSupplement()
Returns the supplement of the CIDSystemInfo.
|
int |
getType()
Returns the type of the CMap.
|
java.lang.String |
getVersion()
Returns the version of the CMap.
|
int |
getWMode()
Returns the WMode of a CMap.
|
boolean |
hasCIDMappings()
This will tell if this cmap has any CID mappings.
|
boolean |
hasUnicodeMappings()
This will tell if this cmap has any Unicode mappings.
|
int |
readCode(java.io.InputStream in)
Reads a character code from a string in the content stream.
|
void |
setName(java.lang.String name)
Sets the name of the CMap.
|
void |
setOrdering(java.lang.String newOrdering)
Sets the ordering of the CIDSystemInfo.
|
void |
setRegistry(java.lang.String newRegistry)
Sets the registry of the CIDSystemInfo.
|
void |
setSupplement(int newSupplement)
Sets the supplement of the CIDSystemInfo.
|
void |
setType(int type)
Sets the type of the CMap.
|
void |
setVersion(java.lang.String version)
Sets the version of the CMap.
|
void |
setWMode(int newWMode)
Sets the WMode of a CMap.
|
int |
toCID(int code)
Returns the CID for the given character code.
|
(package private) static int |
toInt(byte[] data,
int dataLen)
Returns an int for the given byte array
|
java.lang.String |
toString() |
java.lang.String |
toUnicode(int code)
Returns the sequence of Unicode characters for the given character code.
|
(package private) void |
useCmap(CMap cmap)
Implementation of the usecmap operator.
|
private static final org.apache.commons.logging.Log LOG
private int wmode
private java.lang.String cmapName
private java.lang.String cmapVersion
private int cmapType
private java.lang.String registry
private java.lang.String ordering
private int supplement
private int minCodeLength
private int maxCodeLength
private final java.util.List<CodespaceRange> codespaceRanges
private final java.util.Map<java.lang.Integer,java.lang.String> charToUnicode
private final java.util.Map<java.lang.Integer,java.lang.Integer> codeToCid
private final java.util.List<CIDRange> codeToCidRanges
private static final java.lang.String SPACE
private int spaceMapping
public boolean hasCIDMappings()
public boolean hasUnicodeMappings()
public java.lang.String toUnicode(int code)
code
- character codepublic int readCode(java.io.InputStream in) throws java.io.IOException
See "CMap Mapping" and "Handling Undefined Characters" in PDF32000 for more details.
in
- string streamjava.io.IOException
- if there was an error reading the stream or CMapstatic int toInt(byte[] data, int dataLen)
public int toCID(int code)
code
- character codeprivate int getCodeFromArray(byte[] data, int offset, int length)
data
- the byte arrayoffset
- The offset into the byte array.length
- The length of the data we are getting.void addCharMapping(byte[] codes, java.lang.String unicode)
codes
- The character codes to map from.unicode
- The Unicode characters to map to.void addCIDMapping(int code, int cid)
code
- character codecid
- CIDvoid addCIDRange(char from, char to, int cid)
from
- starting character of the CID range.to
- ending character of the CID range.cid
- the cid to be started with.void addCodespaceRange(CodespaceRange range)
range
- A single codespace range.void useCmap(CMap cmap)
cmap
- The cmap to load mappings from.public int getWMode()
public void setWMode(int newWMode)
newWMode
- the new WMode.public java.lang.String getName()
public void setName(java.lang.String name)
name
- the CMap name.public java.lang.String getVersion()
public void setVersion(java.lang.String version)
version
- the CMap version.public int getType()
public void setType(int type)
type
- the CMap type.public java.lang.String getRegistry()
public void setRegistry(java.lang.String newRegistry)
newRegistry
- the registry.public java.lang.String getOrdering()
public void setOrdering(java.lang.String newOrdering)
newOrdering
- the ordering.public int getSupplement()
public void setSupplement(int newSupplement)
newSupplement
- the supplement.public int getSpaceMapping()
public java.lang.String toString()
toString
in class java.lang.Object