Back to API Reference
Class

Shaper

sealed

Text shaper that converts codepoints to positioned glyphs through a runtime font face. SFNT-backed fonts use HarfBuzz for full OpenType shaping; platform-native faces supply equivalent glyph and positioning results through their backend.

public static Shaper Instance{ get }

Gets the singleton shaper instance.

public static uint GetGlyphIndex(Core font, uint codepoint)

Gets the glyph index for a codepoint in the specified font.

public static bool TryGetGlyphInfo(Core font, uint codepoint, float fontSize, uint glyphIndex, float advance)

Gets glyph index and advance width for a codepoint.

public static int GetUpemFromFontData()

Reads units-per-em directly from font data without caching. Returns zero for missing input and propagates invalid-font or native ABI failures.

public static void ClearCache(int fontId)

Clears the shaping cache for a specific runtime font id.

public static void ClearAllCaches()

Clears all shaping caches for all fonts.

public float ComputeShapeParams()

Computes per-font shaping parameters in a single font lookup: the spacingOffsetUnits baseline (from SpacingOffset) and per-glyph fakeBoldAdvancePx bonus (from FakeBoldWeight) alongside the returned design-unit-to-pixel scale (incorporates FontScale). Callers cache all three per run-fontId change.