Table of Contents

Enum ClusterLevel

Namespace
Egami.Fonts.Shaping
Assembly
Egami.Fonts.dll

Which characters a glyph's cluster covers, as HarfBuzz's cluster levels.

public enum ClusterLevel

Fields

Characters = 2

Each glyph keeps the cluster of the character it came from where it can; clusters may go down.

MonotoneCharacters = 1

Clusters rise in logical order, but marks keep clusters of their own where the font keeps them apart.

MonotoneGraphemes = 0

Marks merge into their base and clusters rise in logical order: one cluster per grapheme (the default).

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;