public final class Cmap extends Table
A number of subtable formats are designed to combine the decoding of a character stream and the computation of the glyph ID. For example, format 8 is geared to support encoding forms with one or two 16 bits code units (such as UTF-16) and has a 64K bit array to indicate those code units which represent a code point on their own and those code units which are the first of a pair. The idea is that the details of the encoding form can be captured in the font.
Our point of view is that encoding forms are not the business of fonts, so we ignore those parts of those formats.
'cmap' tables have only a minor version number. This implementation:
| Modifier and Type | Class and Description |
|---|---|
static interface |
Cmap.CmapSelector
Class used to receive the list of recognized subtables in this cmap table.
|
static class |
Cmap.MacEncodingID |
static class |
Cmap.MS_EncodingID |
static class |
Cmap.PlatformID
Enum classes for the various platformIDs and encodingIDs.
|
static class |
Cmap.UnicodeEncodingID |
| Modifier and Type | Method and Description |
|---|---|
int |
char2glyph(int ch,
int index) |
int |
coolTypeUnicodeChar2glyph(int usv)
Approximates CoolType's interpretation of cmaps.
|
void |
enumerateCmaps(Cmap.CmapSelector selector)
Enumerate the cmaps contained in the cmap table.
|
int |
getCmapSubtableIndex(int platformId,
int encodingId) |
int |
getHighestMappedCode(int stOffset,
boolean max2bytes)
Get the character code that is the highest that is mapped by the cmap found at
stOffset.
|
int |
getLowestMappedCode(int stOffset)
Get the character code that is the lowest that is mapped by the cmap found at
stOffset.
|
int |
getMapping(int stOffset,
int charCode)
Get the glyphID for charCode using the subtable at stOffset.
|
int |
getOffset(int subtableIndex) |
int[] |
glyph2char(int numGlyphs,
int index)
Get the inverted mapping from glyphs to characters for one subtable.
|
boolean |
isSymbolic()
Tell whether the font is symbolic.
|
int |
probe(int platformID,
int encodingID)
Return the offset of a give cmap subtable if present, -1 otherwise.
|
void |
stream(Map tables) |
void |
streamForSWF(Map tables,
int numGlyphs) |
void |
subsetAndStream(Subset subset,
SubsetSimpleTrueType ttSubset,
Map tables)
In the SubsetSimpleTrueType case, the client will have provided a cmap
and a set of codepoints to map against it.
|
void |
subsetAndStreamForSWF(TreeSet codePoints,
Subset subset,
Map tables,
boolean includeVariationCmap) |
int |
unicodeChar2glyph(int usv)
Get the glyph mapped from a given character.
|
public int probe(int platformID,
int encodingID)
throws InvalidFontException,
UnsupportedFontException
public boolean isSymbolic()
throws UnsupportedFontException,
InvalidFontException
public void enumerateCmaps(Cmap.CmapSelector selector) throws UnsupportedFontException, InvalidFontException
selector - UnsupportedFontExceptionInvalidFontExceptionpublic int getCmapSubtableIndex(int platformId,
int encodingId)
throws InvalidFontException
InvalidFontExceptionpublic int unicodeChar2glyph(int usv)
throws UnsupportedFontException,
InvalidFontException
usv - the Unicode scalar value to look upusv, 0 if not mapped. Note
that this is the true OpenType gid, even in the case of cid cff otf. It is
NOT the cid.UnsupportedFontExceptionInvalidFontExceptionpublic int coolTypeUnicodeChar2glyph(int usv)
throws UnsupportedFontException,
InvalidFontException
public int char2glyph(int ch,
int index)
throws UnsupportedFontException,
InvalidFontException
public int getLowestMappedCode(int stOffset)
throws UnsupportedFontException,
InvalidFontException
public int getHighestMappedCode(int stOffset,
boolean max2bytes)
throws UnsupportedFontException,
InvalidFontException
public int getMapping(int stOffset,
int charCode)
throws UnsupportedFontException,
InvalidFontException
stOffset - the offset (in the cmap table) of the subtable to usecharCode - the character code to mapcharCodeUnsupportedFontExceptionInvalidFontExceptionpublic int getOffset(int subtableIndex)
throws InvalidFontException,
UnsupportedFontException
public int[] glyph2char(int numGlyphs,
int index)
throws UnsupportedFontException,
InvalidFontException
index must
be present.numGlyphs - the number of glyphs in the fontindex - the index of the cmap to invertnumGlyphs integers, mapping
glyphIDs to characters; if a glyphs is not mapped by the
subtable, the value in this array is -1.UnsupportedFontExceptionInvalidFontExceptionpublic void subsetAndStream(Subset subset, SubsetSimpleTrueType ttSubset, Map tables) throws UnsupportedFontException, InvalidFontException
public void subsetAndStreamForSWF(TreeSet codePoints, Subset subset, Map tables, boolean includeVariationCmap) throws UnsupportedFontException, InvalidFontException
public void stream(Map tables)
public void streamForSWF(Map tables, int numGlyphs) throws UnsupportedFontException, InvalidFontException
Copyright © 2010 - 2020 Adobe. All Rights Reserved