LayoutQueries Class
Answers questions about the layout tables of a font without shaping a text: whether it has a feature, what a feature does to a glyph or to a pair of glyphs. The lookups are those of the default language system of a script.
public static class LayoutQueriesRemarks
Each call reads the tables: a caller that asks often keeps the answers.
Methods
| Name | Description |
|---|---|
| GetPairAdjustment(FontFace, uint, int, int, uint) | Gets the adjustments the lookups of a feature of the GPOS table make to two consecutive glyphs, in font units, from positions that are all 0: the advances and the offsets of the two glyphs, the y axis up. For the kern feature, a font without the feature in its GPOS table has the pairs of its legacy kerning table, added to the advance of the first glyph. |
| GetSingleSubstitution(FontFace, uint, int, uint) | Gets the glyph the lookups of a feature of the GSUB table substitute for a glyph (e.g. rtlm, the right-to-left mirrored forms), or the glyph itself when the feature does not substitute it by one glyph. |
| HasFeature(FontFace, bool, UnicodeScript, uint) | Determines whether the default language system of a script has a feature in a layout table of a font. |
| HasFeature(FontFace, bool, uint) | Determines whether a layout table of a font has a feature, whatever the scripts and the language systems that list it. |
| HasVerticalAlternate(FontFace, int) | Determines whether the vert feature of a font, of any script, substitutes a glyph by one glyph: a character whose vertical orientation is "transformed rotated" (Tr) is upright in a vertical line when the font has a vertical alternate for it (Unicode Standard Annex #50). |
| WouldSubstitute(FontFace, UnicodeScript, uint, int) | Determines whether a feature of the default language system of a script substitutes a glyph on its own: whether one of its lookups has a rule whose input is the glyph alone, whatever its context. |
GetPairAdjustment(FontFace, uint, int, int, uint)
LayoutQueries.csGets the adjustments the lookups of a feature of the GPOS table make to two consecutive glyphs, in font units, from positions that are all 0: the advances and the offsets of the two glyphs, the y axis up. For the kern feature, a font without the feature in its GPOS table has the pairs of its legacy kerning table, added to the advance of the first glyph.
public static (GlyphPosition First, GlyphPosition Second) GetPairAdjustment(FontFace face, uint feature, int first, int second, uint scriptTag)Parameters
faceFontFace- The font.
featureuint- The tag of the feature.
firstint- The first glyph.
secondint- The second glyph.
scriptTaguint- The OpenType tag of the script, whose default language system is used; else the one of
DFLT,dfltorlatn.
Returns
(GlyphPosition First, GlyphPosition Second)
Exceptions
InvalidFontException- The
GPOStable is malformed.
GetSingleSubstitution(FontFace, uint, int, uint)
LayoutQueries.csGets the glyph the lookups of a feature of the GSUB table substitute for a glyph (e.g. rtlm, the right-to-left mirrored forms), or the glyph itself when the feature does not substitute it by one glyph.
HasFeature overloads
HasFeature(FontFace, bool, UnicodeScript, uint)
LayoutQueries.csDetermines whether the default language system of a script has a feature in a layout table of a font.
public static bool HasFeature(FontFace face, bool isPositioning, UnicodeScript script, uint feature)Parameters
faceFontFaceisPositioningboolscriptUnicodeScriptfeatureuint
Returns
Exceptions
InvalidFontException- The table is malformed.
HasFeature(FontFace, bool, uint)
LayoutQueries.csDetermines whether a layout table of a font has a feature, whatever the scripts and the language systems that list it.
HasVerticalAlternate(FontFace, int)
LayoutQueries.csDetermines whether the vert feature of a font, of any script, substitutes a glyph by one glyph: a character whose vertical orientation is "transformed rotated" (Tr) is upright in a vertical line when the font has a vertical alternate for it (Unicode Standard Annex #50).
WouldSubstitute(FontFace, UnicodeScript, uint, int)
LayoutQueries.csDetermines whether a feature of the default language system of a script substitutes a glyph on its own: whether one of its lookups has a rule whose input is the glyph alone, whatever its context.
public static bool WouldSubstitute(FontFace face, UnicodeScript script, uint feature, int glyph)Parameters
faceFontFacescriptUnicodeScriptfeatureuintglyphint
Returns
Exceptions
InvalidFontException- The
GSUBtable is malformed.
Fields
| Name | Description |
|---|---|
| DefaultScript | The tag of the default script, and the scripts a feature of a script is looked for in after it. |
DefaultScript
The tag of the default script, and the scripts a feature of a script is looked for in after it.
public static readonly uint DefaultScript