org.foray.font.format.ttf
Class TTFTableCMAP

java.lang.Object
  extended by org.foray.font.format.ttf.TTFTableCMAP

public class TTFTableCMAP
extends Object

Class representing a TTF "cmap" (character-to-glyph index mapping) table.


Field Summary
protected static byte BYTE_BYTES
          The size, in bytes of the data type "BYTE", that is, 1.
protected static byte CHAR_BYTES
          The size, in bytes of the data type "CHAR", that is, 1.
static byte CMAP_FORMAT_0
          Constant indicating that this CMap table is format 0.
static byte CMAP_FORMAT_12
          Constant indicating that this CMap table is format 12.
static byte CMAP_FORMAT_2
          Constant indicating that this CMap table is format 2.
static byte CMAP_FORMAT_4
          Constant indicating that this CMap table is format 4.
static byte CMAP_FORMAT_6
          Constant indicating that this CMap table is format 6.
static byte CMAP_FORMAT_UNKNOWN
          Constant indicating that this CMap table is in an unknown format.
protected static int ENCODING_UCS_4
          Constant indicating that the encoding is Unicode UCS-4.
protected static int ENCODING_UNICODE
          Constant indicating that the encoding is Unicode.
protected static byte F2DOT14_BYTES
          The size, in bytes of the data type "F2DOT14", that is, 2.
protected static byte FIXED_BYTES
          The size, in bytes of the data type "FIXED", that is, 4.
protected static byte FWORD_BYTES
          The size, in bytes of the data type "FWORD", that is, 2.
protected static byte LONG_BYTES
          The size, in bytes of the data type "LONG", that is, 4.
protected static byte LONG_DATE_TIME_BYTES
          The size, in bytes of the data type "International Date", that is, 8.
protected static byte OFFSET_BYTES
          The size, in bytes of the data type "Offset", that is, 2.
protected static int PLATFORM_MICROSOFT
          Constant indicating that the platform is Microsoft.
protected static byte SHORT_BYTES
          The size, in bytes of the data type "SHORT", that is, 2.
protected static byte UFWORD_BYTES
          The size, in bytes of the data type "UFWORD", that is, 2.
protected static byte ULONG_BYTES
          The size, in bytes of the data type "ULONG", that is, 4.
protected static byte USHORT_BYTES
          The size, in bytes of the data type "USHORT", that is, 2.
 
Constructor Summary
TTFTableCMAP(TTFOffsetTableRecord dirEntry)
          Constructor.
 
Method Summary
 int decodeCharacter(int glyphIndex)
          Decodes a glyph index using the Unicode CMap from this table.
 int encodeCharacter(int codePoint)
          Encode a specific character using the Unicode CMap from this table.
 String getTableTag()
          Return the 4-character name of this table, for example, "post" or "glyf".
 org.axsl.ps.Cmap getUnicodeCMap()
          Returns the Unicode CMap instance parsed from this table.
static TTFTableCMAP parse(TTFOffsetTableRecord dirEntry, RandomAccessInput raInput, org.axsl.ps.PsServer psServer, String fontPostScriptName)
          Parse the cmap table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CMAP_FORMAT_UNKNOWN

public static final byte CMAP_FORMAT_UNKNOWN
Constant indicating that this CMap table is in an unknown format.

See Also:
Constant Field Values

CMAP_FORMAT_0

public static final byte CMAP_FORMAT_0
Constant indicating that this CMap table is format 0.

See Also:
Constant Field Values

CMAP_FORMAT_2

public static final byte CMAP_FORMAT_2
Constant indicating that this CMap table is format 2.

See Also:
Constant Field Values

CMAP_FORMAT_4

public static final byte CMAP_FORMAT_4
Constant indicating that this CMap table is format 4.

See Also:
Constant Field Values

CMAP_FORMAT_6

public static final byte CMAP_FORMAT_6
Constant indicating that this CMap table is format 6.

See Also:
Constant Field Values

CMAP_FORMAT_12

public static final byte CMAP_FORMAT_12
Constant indicating that this CMap table is format 12.

See Also:
Constant Field Values

PLATFORM_MICROSOFT

protected static final int PLATFORM_MICROSOFT
Constant indicating that the platform is Microsoft.

See Also:
Constant Field Values

ENCODING_UNICODE

protected static final int ENCODING_UNICODE
Constant indicating that the encoding is Unicode.

See Also:
Constant Field Values

ENCODING_UCS_4

protected static final int ENCODING_UCS_4
Constant indicating that the encoding is Unicode UCS-4.

See Also:
Constant Field Values

BYTE_BYTES

protected static final byte BYTE_BYTES
The size, in bytes of the data type "BYTE", that is, 1.

See Also:
Constant Field Values

CHAR_BYTES

protected static final byte CHAR_BYTES
The size, in bytes of the data type "CHAR", that is, 1.

See Also:
Constant Field Values

USHORT_BYTES

protected static final byte USHORT_BYTES
The size, in bytes of the data type "USHORT", that is, 2.

See Also:
Constant Field Values

SHORT_BYTES

protected static final byte SHORT_BYTES
The size, in bytes of the data type "SHORT", that is, 2.

See Also:
Constant Field Values

ULONG_BYTES

protected static final byte ULONG_BYTES
The size, in bytes of the data type "ULONG", that is, 4.

See Also:
Constant Field Values

LONG_BYTES

protected static final byte LONG_BYTES
The size, in bytes of the data type "LONG", that is, 4.

See Also:
Constant Field Values

FIXED_BYTES

protected static final byte FIXED_BYTES
The size, in bytes of the data type "FIXED", that is, 4.

See Also:
Constant Field Values

FWORD_BYTES

protected static final byte FWORD_BYTES
The size, in bytes of the data type "FWORD", that is, 2.

See Also:
Constant Field Values

UFWORD_BYTES

protected static final byte UFWORD_BYTES
The size, in bytes of the data type "UFWORD", that is, 2.

See Also:
Constant Field Values

F2DOT14_BYTES

protected static final byte F2DOT14_BYTES
The size, in bytes of the data type "F2DOT14", that is, 2.

See Also:
Constant Field Values

LONG_DATE_TIME_BYTES

protected static final byte LONG_DATE_TIME_BYTES
The size, in bytes of the data type "International Date", that is, 8.

See Also:
Constant Field Values

OFFSET_BYTES

protected static final byte OFFSET_BYTES
The size, in bytes of the data type "Offset", that is, 2.

See Also:
Constant Field Values
Constructor Detail

TTFTableCMAP

public TTFTableCMAP(TTFOffsetTableRecord dirEntry)
Constructor.

Parameters:
dirEntry - The parent table directory entry.
Method Detail

parse

public static TTFTableCMAP parse(TTFOffsetTableRecord dirEntry,
                                 RandomAccessInput raInput,
                                 org.axsl.ps.PsServer psServer,
                                 String fontPostScriptName)
                          throws IOException
Parse the cmap table. Currently only unicode cmaps are supported.

Parameters:
dirEntry - The parent table directory entry.
raInput - The input which is being parsed.
psServer - The PostScript server.
fontPostScriptName - The PostScript name of this font.
Returns:
The parsed instance.
Throws:
IOException - For I/O Error.

getTableTag

public String getTableTag()
Return the 4-character name of this table, for example, "post" or "glyf".

Returns:
The name of this table.

getUnicodeCMap

public org.axsl.ps.Cmap getUnicodeCMap()
Returns the Unicode CMap instance parsed from this table.

Returns:
The Unicode CMap instance parsed from this table.

encodeCharacter

public int encodeCharacter(int codePoint)
Encode a specific character using the Unicode CMap from this table.

Parameters:
codePoint - The code point to be encoded.
Returns:
The glyph index corresponding to codePoint.

decodeCharacter

public int decodeCharacter(int glyphIndex)
Decodes a glyph index using the Unicode CMap from this table.

Parameters:
glyphIndex - The glyph index to be decoded.
Returns:
The Unicode code point corresponding to glyphIndex.


Copyright © 2017. All rights reserved.