Package com.lowagie.text.pdf.fonts.cmaps
Class CMap
- java.lang.Object
-
- com.lowagie.text.pdf.fonts.cmaps.CMap
-
public class CMap extends java.lang.Object
This class represents a CMap file.- Since:
- 2.1.4
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<CodespaceRange>
codeSpaceRanges
private java.util.Map<java.lang.Integer,java.lang.String>
doubleByteMappings
private java.util.Map<java.lang.Integer,java.lang.String>
singleByteMappings
-
Constructor Summary
Constructors Constructor Description CMap()
Creates a new instance of CMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCodespaceRange(CodespaceRange range)
This will add a codespace range.void
addMapping(byte[] src, java.lang.String dest)
This will add a mapping.java.util.List
getCodeSpaceRanges()
Getter for property codeSpaceRanges.boolean
hasOneByteMappings()
This will tell if this cmap has any one byte mappings.boolean
hasTwoByteMappings()
This will tell if this cmap has any two byte mappings.java.lang.String
lookup(byte[] code, int offset, int length)
This will perform a lookup into the map.java.lang.String
lookup(char code)
This will perform a lookup into the map.
-
-
-
Field Detail
-
codeSpaceRanges
private java.util.List<CodespaceRange> codeSpaceRanges
-
singleByteMappings
private java.util.Map<java.lang.Integer,java.lang.String> singleByteMappings
-
doubleByteMappings
private java.util.Map<java.lang.Integer,java.lang.String> doubleByteMappings
-
-
Method Detail
-
hasOneByteMappings
public boolean hasOneByteMappings()
This will tell if this cmap has any one byte mappings.- Returns:
- true If there are any one byte mappings, false otherwise.
-
hasTwoByteMappings
public boolean hasTwoByteMappings()
This will tell if this cmap has any two byte mappings.- Returns:
- true If there are any two byte mappings, false otherwise.
-
lookup
public java.lang.String lookup(char code)
This will perform a lookup into the map.Some characters (e.g. ligatures) decode to character sequences.
- Parameters:
code
- The code used to lookup.- Returns:
- The string that matches the lookup.
-
lookup
public java.lang.String 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.
-
addMapping
public void addMapping(byte[] src, java.lang.String dest) throws java.io.IOException
This will add a mapping.- Parameters:
src
- The src to the mapping.dest
- The dest to the mapping.- Throws:
java.io.IOException
- if the src is invalid.
-
addCodespaceRange
public void addCodespaceRange(CodespaceRange range)
This will add a codespace range.- Parameters:
range
- A single codespace range.
-
getCodeSpaceRanges
public java.util.List getCodeSpaceRanges()
Getter for property codeSpaceRanges.- Returns:
- Value of property codeSpaceRanges.
-
-