Class TtfHmtxTable
Parsed OpenType "hmtx" table (horizontal metrics).
Stores advance width and left side-bearing for every glyph.
The first numberOfHMetrics glyphs each have their own advance width;
glyphs beyond that index share the last advance width value.
Ref: OpenType spec §5.2.4.
Inherited Members
Namespace: DRIT.Drawing.Font.Ttf.Tables
Assembly: DRIT.Drawing.dll
Syntax
public sealed class TtfHmtxTable : TtfTableBase
Fields
TableTag
The table tag for the hmtx table.
Declaration
public const string TableTag = "hmtx"
Field Value
| Type | Description |
|---|---|
| string |
Methods
GetAdvanceWidth(int)
Returns the advance width for glyphIndex, in design units.
Glyphs with index ≥ numberOfHMetrics return the last recorded advance width.
Declaration
public ushort GetAdvanceWidth(int glyphIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | glyphIndex |
Returns
| Type | Description |
|---|---|
| ushort |
GetLsb(int)
Returns the left side-bearing for glyphIndex, in design units.
Declaration
public short GetLsb(int glyphIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | glyphIndex |
Returns
| Type | Description |
|---|---|
| short |
Parse(byte[], ushort, ushort)
Parses the "hmtx" table from its raw bytes.
Declaration
public static TtfHmtxTable Parse(byte[] rawBytes, ushort numberOfHMetrics, ushort numGlyphs)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | rawBytes | Raw table data. |
| ushort | numberOfHMetrics | Value from NumberOfHMetrics. Determines how many full (width+lsb) entries are present. |
| ushort | numGlyphs | Total glyph count from NumGlyphs. Determines how many extra LSB-only entries follow. |
Returns
| Type | Description |
|---|---|
| TtfHmtxTable |