org.foray.ps.encode
Class CMap12Entry

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

public class CMap12Entry
extends Object

Contains one entry from a TrueType CMap subtable, Format 12, which handles 32-bit Unicode codepoint ranges.


Constructor Summary
CMap12Entry(int unicodeStart, int unicodeEnd, int glyphStartIndex)
          Constructor.
 
Method Summary
 boolean containsChar(int codePoint)
          Indicates whether this entry can encode a given character.
 int decodeCharacter(int glyphIndex)
          Decodes a given glyphIndex.
 int encodeCharacter(int codePoint)
          Encodes a given character.
 int 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

CMap12Entry

public CMap12Entry(int unicodeStart,
                   int unicodeEnd,
                   int glyphStartIndex)
Constructor.

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.
Method Detail

getGlyphEndIndex

public int 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(int codePoint)
Indicates whether this entry can encode a given character.

Parameters:
codePoint - The Unicode code point to be tested.
Returns:
True iff this entry has encoding information for codePoint.

encodeCharacter

public int encodeCharacter(int codePoint)
Encodes a given character.

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

decodeCharacter

public int 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.