LayoutTable Class

The structure the GSUB and GPOS tables share: scripts, language systems, features and lookups. OpenType specification, "OpenType Layout Common Table Formats".

public sealed class LayoutTable

Remarks

The header is validated when the table is read; everything else is validated when it is used, and a reference outside the table is an InvalidFontException.

Methods

NameDescription
FindFeature(ReadOnlySpan<byte>, uint)Finds the first feature of the feature list that has a tag, whatever the scripts and the language systems that list it.
FindFeatureSubstitutions(ReadOnlySpan<byte>, ReadOnlySpan<int>)Finds the feature substitutions that apply to an instance of a variable font: "FeatureVariations table". The first record whose conditions all hold is the one that applies.
FindLanguageSystem(ReadOnlySpan<byte>, ReadOnlySpan<uint>, ReadOnlySpan<uint>)Finds the language system of a script and a language.
FindScriptTag(ReadOnlySpan<byte>, ReadOnlySpan<uint>)Finds the tag the table has for a script: the first of the tags of the script it has, or 0.
GetFeatureCount(ReadOnlySpan<byte>, int)Gets the number of features of a language system.
GetFeatureIndex(ReadOnlySpan<byte>, int, int)Gets the index, in the feature list, of a feature of a language system.
GetFeatureListCount(ReadOnlySpan<byte>)Gets the number of features of the feature list.
GetFeatureLookup(ReadOnlySpan<byte>, int, int, int)Gets a lookup of a feature of the feature list.
GetFeatureLookupCount(ReadOnlySpan<byte>, int, int)Gets the number of lookups of a feature of the feature list.
GetFeatureTag(ReadOnlySpan<byte>, int)Gets the tag of a feature of the feature list, or 0 when the index is not one of its features.
GetLookupCount(ReadOnlySpan<byte>)Gets the number of lookups.
GetRequiredFeature(ReadOnlySpan<byte>, int)Gets the feature a language system requires, or LayoutTable.NoFeature.
Read(ReadOnlySpan<byte>)Reads the header of a GSUB or GPOS table.

FindFeature(ReadOnlySpan<byte>, uint)

LayoutTable.cs

Finds the first feature of the feature list that has a tag, whatever the scripts and the language systems that list it.

public int FindFeature(ReadOnlySpan<byte> table, uint tag)

Parameters

table ReadOnlySpan<byte>
tag uint

Returns

int The index of the feature in the feature list, or LayoutTable.NoFeature.

FindFeatureSubstitutions(ReadOnlySpan<byte>, ReadOnlySpan<int>)

LayoutTable.cs

Finds the feature substitutions that apply to an instance of a variable font: "FeatureVariations table". The first record whose conditions all hold is the one that applies.

public int FindFeatureSubstitutions(ReadOnlySpan<byte> table, ReadOnlySpan<int> coordinates)

Parameters

table ReadOnlySpan<byte>
The table.
coordinates ReadOnlySpan<int>
The normalized coordinates of the instance, as 2.14 fixed-point numbers; an axis without coordinate is at its default.

Returns

int The position of the feature table substitution, or 0 when no feature is replaced.

FindLanguageSystem(ReadOnlySpan<byte>, ReadOnlySpan<uint>, ReadOnlySpan<uint>)

LayoutTable.cs

Finds the language system of a script and a language.

public int FindLanguageSystem(ReadOnlySpan<byte> table, ReadOnlySpan<uint> scripts, ReadOnlySpan<uint> languages)

Parameters

table ReadOnlySpan<byte>
The table.
scripts ReadOnlySpan<uint>
The tags of the script, by order of preference.
languages ReadOnlySpan<uint>
The tags of the language, by order of preference; the default language system of the script is used when the script has none of them, or when there is no tag.

Returns

int The position of the language system, or 0 when the table has none for the script.

FindScriptTag(ReadOnlySpan<byte>, ReadOnlySpan<uint>)

LayoutTable.cs

Finds the tag the table has for a script: the first of the tags of the script it has, or 0.

public uint FindScriptTag(ReadOnlySpan<byte> table, ReadOnlySpan<uint> scripts)

Parameters

table ReadOnlySpan<byte>
The table.
scripts ReadOnlySpan<uint>
The tags of the script, by order of preference.

Returns

uint

GetFeatureCount(ReadOnlySpan<byte>, int)

LayoutTable.cs

Gets the number of features of a language system.

public static int GetFeatureCount(ReadOnlySpan<byte> table, int languageSystem)

Parameters

table ReadOnlySpan<byte>
languageSystem int

Returns

int

GetFeatureIndex(ReadOnlySpan<byte>, int, int)

LayoutTable.cs

Gets the index, in the feature list, of a feature of a language system.

public static int GetFeatureIndex(ReadOnlySpan<byte> table, int languageSystem, int index)

Parameters

table ReadOnlySpan<byte>
languageSystem int
index int

Returns

int

GetFeatureListCount(ReadOnlySpan<byte>)

LayoutTable.cs

Gets the number of features of the feature list.

public int GetFeatureListCount(ReadOnlySpan<byte> table)

Parameters

table ReadOnlySpan<byte>

Returns

int

GetFeatureLookup(ReadOnlySpan<byte>, int, int, int)

LayoutTable.cs

Gets a lookup of a feature of the feature list.

public int GetFeatureLookup(ReadOnlySpan<byte> table, int feature, int index, int substitutions = 0)

Parameters

table ReadOnlySpan<byte>
feature int
index int
substitutions int

Returns

int

GetFeatureLookupCount(ReadOnlySpan<byte>, int, int)

LayoutTable.cs

Gets the number of lookups of a feature of the feature list.

public int GetFeatureLookupCount(ReadOnlySpan<byte> table, int feature, int substitutions = 0)

Parameters

table ReadOnlySpan<byte>
The table.
feature int
The index of the feature in the feature list.
substitutions int
The feature substitutions of the instance, from LayoutTable.FindFeatureSubstitutions, or 0.

Returns

int

GetFeatureTag(ReadOnlySpan<byte>, int)

LayoutTable.cs

Gets the tag of a feature of the feature list, or 0 when the index is not one of its features.

public uint GetFeatureTag(ReadOnlySpan<byte> table, int feature)

Parameters

table ReadOnlySpan<byte>
feature int

Returns

uint

GetLookupCount(ReadOnlySpan<byte>)

LayoutTable.cs

Gets the number of lookups.

public int GetLookupCount(ReadOnlySpan<byte> table)

Parameters

table ReadOnlySpan<byte>

Returns

int

GetRequiredFeature(ReadOnlySpan<byte>, int)

LayoutTable.cs

Gets the feature a language system requires, or LayoutTable.NoFeature.

public static int GetRequiredFeature(ReadOnlySpan<byte> table, int languageSystem)

Parameters

table ReadOnlySpan<byte>
languageSystem int

Returns

int

Read(ReadOnlySpan<byte>)

LayoutTable.cs

Reads the header of a GSUB or GPOS table.

public static LayoutTable? Read(ReadOnlySpan<byte> table)

Parameters

table ReadOnlySpan<byte>

Returns

LayoutTable? The table, or null when its version is not known or it has no lookup: the font is then used without it.

Constants

NameDescription
NoFeatureThe index of a feature that is not required: a language system that has no required feature.

NoFeature

The index of a feature that is not required: a language system that has no required feature.

public const int NoFeature = 65535