public class CmapSubtable extends java.lang.Object implements CmapLookup
Modifier and Type | Class and Description |
---|---|
private static class |
CmapSubtable.SubHeader
Class used to manage CMap - Format 2.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Integer,java.lang.Integer> |
characterCodeToGlyphId |
private int[] |
glyphIdToCharacterCode |
private java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> |
glyphIdToCharacterCodeMultiple |
private static long |
LEAD_OFFSET |
private static org.apache.commons.logging.Log |
LOG |
private int |
platformEncodingId |
private int |
platformId |
private long |
subTableOffset |
private static long |
SURROGATE_OFFSET |
Constructor and Description |
---|
CmapSubtable() |
Modifier and Type | Method and Description |
---|---|
private void |
buildGlyphIdToCharacterCodeLookup(int maxGlyphId) |
java.lang.Integer |
getCharacterCode(int gid)
Deprecated.
the mapping may be ambiguous, see
getCharCodes(int) . The first mapped value is returned by
default. |
private int |
getCharCode(int gid) |
java.util.List<java.lang.Integer> |
getCharCodes(int gid)
Returns all possible character codes for the given gid, or null if there is none.
|
int |
getGlyphId(int characterCode)
Returns the GlyphId linked with the given character code.
|
int |
getPlatformEncodingId() |
int |
getPlatformId() |
(package private) void |
initData(TTFDataStream data)
This will read the required data from the stream.
|
(package private) void |
initSubtable(CmapTable cmap,
int numGlyphs,
TTFDataStream data)
This will read the required data from the stream.
|
private int[] |
newGlyphIdToCharacterCode(int size)
Workaround for the fact that glyphIdToCharacterCode doesn't distinguish between
missing character codes and code 0.
|
(package private) void |
processSubtype0(TTFDataStream data)
Initialize the CMapEntry when it is a subtype 0.
|
(package private) void |
processSubtype10(TTFDataStream data,
int numGlyphs)
Reads a format 10 subtable.
|
(package private) void |
processSubtype12(TTFDataStream data,
int numGlyphs)
Reads a format 12 subtable.
|
(package private) void |
processSubtype13(TTFDataStream data,
int numGlyphs)
Reads a format 13 subtable.
|
(package private) void |
processSubtype14(TTFDataStream data,
int numGlyphs)
Reads a format 14 subtable.
|
(package private) void |
processSubtype2(TTFDataStream data,
int numGlyphs)
Read a format 2 subtable.
|
(package private) void |
processSubtype4(TTFDataStream data,
int numGlyphs)
Reads a format 4 subtable.
|
(package private) void |
processSubtype6(TTFDataStream data,
int numGlyphs)
Reads a format 6 subtable.
|
(package private) void |
processSubtype8(TTFDataStream data,
int numGlyphs)
Reads a format 8 subtable.
|
void |
setPlatformEncodingId(int platformEncodingIdValue) |
void |
setPlatformId(int platformIdValue) |
java.lang.String |
toString() |
private static final org.apache.commons.logging.Log LOG
private static final long LEAD_OFFSET
private static final long SURROGATE_OFFSET
private int platformId
private int platformEncodingId
private long subTableOffset
private int[] glyphIdToCharacterCode
private final java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> glyphIdToCharacterCodeMultiple
private java.util.Map<java.lang.Integer,java.lang.Integer> characterCodeToGlyphId
void initData(TTFDataStream data) throws java.io.IOException
data
- The stream to read the data from.java.io.IOException
- If there is an error reading the data.void initSubtable(CmapTable cmap, int numGlyphs, TTFDataStream data) throws java.io.IOException
cmap
- the CMAP this encoding belongs to.numGlyphs
- number of glyphs.data
- The stream to read the data from.java.io.IOException
- If there is an error reading the data.void processSubtype8(TTFDataStream data, int numGlyphs) throws java.io.IOException
data
- the data stream of the to be parsed ttf fontnumGlyphs
- number of glyphs to be readjava.io.IOException
- If there is an error parsing the true type font.void processSubtype10(TTFDataStream data, int numGlyphs) throws java.io.IOException
data
- the data stream of the to be parsed ttf fontnumGlyphs
- number of glyphs to be readjava.io.IOException
- If there is an error parsing the true type font.void processSubtype12(TTFDataStream data, int numGlyphs) throws java.io.IOException
data
- the data stream of the to be parsed ttf fontnumGlyphs
- number of glyphs to be readjava.io.IOException
- If there is an error parsing the true type font.void processSubtype13(TTFDataStream data, int numGlyphs) throws java.io.IOException
data
- the data stream of the to be parsed ttf fontnumGlyphs
- number of glyphs to be readjava.io.IOException
- If there is an error parsing the true type font.void processSubtype14(TTFDataStream data, int numGlyphs) throws java.io.IOException
data
- the data stream of the to be parsed ttf fontnumGlyphs
- number of glyphs to be readjava.io.IOException
- If there is an error parsing the true type font.void processSubtype6(TTFDataStream data, int numGlyphs) throws java.io.IOException
data
- the data stream of the to be parsed ttf fontnumGlyphs
- number of glyphs to be readjava.io.IOException
- If there is an error parsing the true type font.void processSubtype4(TTFDataStream data, int numGlyphs) throws java.io.IOException
data
- the data stream of the to be parsed ttf fontnumGlyphs
- number of glyphs to be readjava.io.IOException
- If there is an error parsing the true type font.private void buildGlyphIdToCharacterCodeLookup(int maxGlyphId)
void processSubtype2(TTFDataStream data, int numGlyphs) throws java.io.IOException
data
- the data stream of the to be parsed ttf fontnumGlyphs
- number of glyphs to be readjava.io.IOException
- If there is an error parsing the true type font.void processSubtype0(TTFDataStream data) throws java.io.IOException
data
- the data stream of the to be parsed ttf fontjava.io.IOException
- If there is an error parsing the true type font.private int[] newGlyphIdToCharacterCode(int size)
public int getPlatformEncodingId()
public void setPlatformEncodingId(int platformEncodingIdValue)
platformEncodingIdValue
- The platformEncodingId to set.public int getPlatformId()
public void setPlatformId(int platformIdValue)
platformIdValue
- The platformId to set.public int getGlyphId(int characterCode)
getGlyphId
in interface CmapLookup
characterCode
- the given character code to be mappedpublic java.lang.Integer getCharacterCode(int gid)
getCharCodes(int)
. The first mapped value is returned by
default.gid
- glyph idprivate int getCharCode(int gid)
public java.util.List<java.lang.Integer> getCharCodes(int gid)
getCharCodes
in interface CmapLookup
gid
- glyph idpublic java.lang.String toString()
toString
in class java.lang.Object