Enum GlyphFlags
What a shaped glyph says about breaking the text next to it, as HarfBuzz's glyph flags.
[Flags]
[SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "HarfBuzz's name for these flags (hb_glyph_flags_t), which shaping code knows.")]
public enum GlyphFlags
Fields
None = 0The text can be broken before this glyph's cluster without shaping again.
SafeToInsertTatweel = 4A tatweel (U+0640) can go before this glyph's cluster to lengthen the word without changing the shaping around it, as kashida justification needs; only set when ProduceSafeToInsertTatweel or ProduceSafeToInsertTatweel asks for it. Where it is set, UnsafeToBreak is too.
UnsafeToBreak = 1Breaking the text before this glyph's cluster changes the shaping: shape the pieces again.
UnsafeToConcat = 2Shaping the text before and after this point separately and joining the results may differ from shaping it whole.
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;