org.foray.ps.encode
Class CMap04Entry

java.lang.Object
  extended by org.foray.ps.encode.CMap04Entry

public class CMap04Entry
extends Object

Contains one entry from a TrueType CMap subtable, format 4, which handles 16-bit Unicode codepoint ranges.


Constructor Summary
CMap04Entry(char unicodeStart, char unicodeEnd, char glyphStartIndex)
          Constructor for contiguous entries.
CMap04Entry(char unicodeStart, char unicodeEnd, char[] glyphIndexes)
          Constructor for non-contiguous entries.
 
Method Summary
 boolean containsChar(char c)
          Indicates whether this entry can encode a given character.
 char decodeCharacter(int glyphIndex)
          Decodes a given glyphIndex.
 char encodeCharacter(char c)
          Encodes a given character.
 char getGlyphEndIndex()
          Compute the glyphEndIndex that is implied from the raw data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMap04Entry

public CMap04Entry(char unicodeStart,
                   char unicodeEnd,
                   char glyphStartIndex)
Constructor for contiguous entries.

Parameters:
unicodeStart - The starting Unicode code point covered by this mapping.
unicodeEnd - The ending Unicode code point covered by this mapping.
glyphStartIndex - The starting glyph index mapped by this mapping. This is the encoded value for unicodeStart.

CMap04Entry

public CMap04Entry(char unicodeStart,
                   char unicodeEnd,
                   char[] glyphIndexes)
Constructor for non-contiguous entries.

Parameters:
unicodeStart - The starting Unicode code point covered by this mapping.
unicodeEnd - The ending Unicode code point covered by this mapping.
glyphIndexes - The array of encoded glyph indexes corresponding to the range unicodeStart through unicodeEnd.
Method Detail

getGlyphEndIndex

public char getGlyphEndIndex()
Compute the glyphEndIndex that is implied from the raw data.

Returns:
The last glyphIndex that is addressed by this entry, i.e. the glyph index that corresponds to unicodeEnd.

containsChar

public boolean containsChar(char c)
Indicates whether this entry can encode a given character.

Parameters:
c - The character to be tested.
Returns:
True iff this entry has encoding information for c.

encodeCharacter

public char encodeCharacter(char c)
Encodes a given character.

Parameters:
c - The character to be encoded.
Returns:
The glyph index corresponding to c, or zero if this entry does not know how to encode it.

decodeCharacter

public char decodeCharacter(int glyphIndex)
Decodes a given glyphIndex.

Parameters:
glyphIndex - The glyph index to be decoded.
Returns:
The Unicode code point corresponding to glyphIndex, or Character.MAX_VALUE if this entry does not know how to decode it.


Copyright © 2017. All rights reserved.