Struct RunProperties
What one run of text is shaped as: its script, language, direction, features and cluster level.
public readonly record struct RunProperties : IEquatable<RunProperties>
- Implements
- Inherited Members
Examples
// One run, one font, as HarfBuzz's hb_shape: ligatures, kerning and marks from the font's GSUB and GPOS.
var font = new Font(face, 24);
var glyphs = new GlyphBuffer();
string text = "office";
TextShaper.ShapeRun(text, 0, text.Length, font, new RunProperties { Script = Script.Latin }, glyphs);
for (int i = 0; i < glyphs.Count; i++)
{
ushort id = glyphs.GlyphIds[i];
int cluster = glyphs.Clusters[i]; // index in text the glyph came from
GlyphPosition position = glyphs.Positions[i]; // in the font's units (pixels here)
bool breakable = (glyphs.Flags[i] & GlyphFlags.UnsafeToBreak) == 0;
}
float width = glyphs.Advance;
Properties
ClusterLevel
Gets how characters group into clusters.
public ClusterLevel ClusterLevel { get; init; }
Property Value
Direction
Gets the direction; Auto takes the script's (right to left for Arabic or Hebrew).
public TextDirection Direction { get; init; }
Property Value
Features
Gets the feature settings, in order; later settings of a tag override earlier ones.
public IReadOnlyList<FontFeature>? Features { get; init; }
Property Value
Language
Gets the BCP 47 language tag, such as ur or sr-Latn, or null for the font's default forms.
public string? Language { get; init; }
Property Value
ProduceSafeToInsertTatweel
Gets whether glyphs say where a tatweel can lengthen a word (SafeToInsertTatweel), as
HarfBuzz's HB_BUFFER_FLAG_PRODUCE_SAFE_TO_INSERT_TATWEEL.
public bool ProduceSafeToInsertTatweel { get; init; }
Property Value
Script
Gets the script, or null to take it from the first character that has one.
public Script? Script { get; init; }