org.foray.font.format.ttf
Class TTFTableHMTX

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

public class TTFTableHMTX
extends Object

Class representing a TTF "hmtx" (horizontal metrics) 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.
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 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
TTFTableHMTX(TTFOffsetTableRecord dirEntry)
          Constructor.
 
Method Summary
 org.foray.font.format.ttf.TTFMtxEntry getMtxEntry(int index)
          Return a specific metric record.
 String getTableTag()
          Return the 4-character name of this table, for example, "post" or "glyf".
 int numMtxEntries()
          Returns the number of metric records in this table.
static TTFTableHMTX parse(TTFOffsetTableRecord dirEntry, RandomAccessInput raInput, int numberOfGlyphs, int numberOfHMetrics)
          Read "hmtx" table and put the horizontal metrics in the metrics array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

TTFTableHMTX

public TTFTableHMTX(TTFOffsetTableRecord dirEntry)
Constructor.

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

parse

public static TTFTableHMTX parse(TTFOffsetTableRecord dirEntry,
                                 RandomAccessInput raInput,
                                 int numberOfGlyphs,
                                 int numberOfHMetrics)
                          throws IOException
Read "hmtx" table and put the horizontal metrics in the metrics array. If the number of metrics is less than the number of glyphs (eg fixed size fonts), extend the metrics array and fill in the missing widths.

Parameters:
dirEntry - The parent table directory entry.
raInput - The input which is being parsed.
numberOfGlyphs - The number of glyphs in the font. This information is derived from the "maxp" table.
numberOfHMetrics - The number of horizontal metrics in the font. This information is derived from the "hhea" table.
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.

getMtxEntry

public org.foray.font.format.ttf.TTFMtxEntry getMtxEntry(int index)
Return a specific metric record.

Parameters:
index - The index to the desired metric record.
Returns:
The metric record corresponding to index.

numMtxEntries

public int numMtxEntries()
Returns the number of metric records in this table.

Returns:
The number of metric records in this table.


Copyright © 2017. All rights reserved.