PeachDrawing.Text

PeachDrawing.Text.Shaping

ShapeSettings Struct

Everything a caller can ask of the shaper for one run of text.

public readonly record struct ShapeSettings : System.IEquatable<PeachDrawing.Text.Shaping.ShapeSettings>

Implements System.IEquatable<ShapeSettings>

Remarks

The requests fold into one, so the shaper can activate every lookup in a single pass in the order the font’s own lookup list gives. The typed groups (Ligatures, Caps, Numeric, EastAsian, Position) are kept apart from ExplicitFeatures because they carry precedence and alternate-selection rules that a list of tags cannot: a tag a typed group controls is always decided by that group, never by an explicit setting, which is CSS’s rule for font-variant-* over font-feature-settings.

JoiningForms, UseCategories and KhmerCategories are for a run of a joining script, an Indic script shaped by the Universal Shaping Engine, or Khmer respectively, and only one of the three is ever set for a run. The lists are compared by reference when settings are used as a cache key, so two equal lists that are separate objects cache separately, which costs a repeated lookup and never a wrong answer.

Write new ShapeSettings() or Default for the defaults; default(ShapeSettings) is all zeros and means no ligatures and no kerning.

Constructors  
ShapeSettings() Creates the default settings: common and required ligatures, contextual alternates and kerning, and nothing else.
ShapeSettings(LigatureSet, CapsMode, NumeralSet, EastAsianSet, IReadOnlyList<FeatureSetting>, bool, string, string, IReadOnlyList<ArabicJoiningForm>, IReadOnlyList<UseCategory>, bool, SubSuperMode, EmojiMode, IReadOnlyList<KhmerCategory>) Everything a caller can ask of the shaper for one run of text.
Fields  
Default The default settings, which is what new ShapeSettings() gives.
Properties  
Caps The caps feature to apply.
EastAsian The East Asian features to apply.
EmojiMode Which presentation of a character with both a text and an emoji form to choose a glyph for, which is a cmap format 14 lookup and not a feature.
ExplicitFeatures Substitution (GSUB) features asked for by tag, or null for none. Positioning is not controlled this way: kerning is the Kerning setting.
JoiningForms For a run of a joining script, the positional form of each character, one for each code point, as Resolve(IReadOnlyList<int>) returns them; otherwise null.
Kerning Whether to apply the font’s kerning.
KhmerCategories For a Khmer run, HarfBuzz’s own (pre-Universal-Shaping-Engine) shaping category of each code point, as Classify(int) gives them; otherwise null.
Language A BCP 47 language tag that selects language-specific behaviour in the font, or null for none.
Ligatures The ligature features to apply.
Numeric The numeral features to apply.
Position The subscript or superscript feature to apply.
ReverseForDisplay Whether to reverse the shaped glyphs into visual order at the end, and replace mirrorable glyphs by their mirror images, for a run that is laid out right to left. The text the lookups ran over is never reversed. Reversing rewrites each glyph’s XOffset so that it stays in place, and leaves AttachedToIndex empty on every glyph of the reversed run.
ScriptTag The OpenType script tag the run is in (see ForScript(string)), or null to let the font’s default script apply.
UseCategories For a run of an Indic script, the Universal Shaping Engine category of each code point, as Classify(int) gives them; otherwise null.