Docsv3.31.0
Back to API Reference
Class

Shaper

static

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 uint GetGlyphIndex(UniTextFont.Core font, uint codepoint)

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

public static bool TryGetGlyphInfo(UniTextFont.Core font, uint codepoint, float fontSize, out uint glyphIndex, out float advance, float normalizationScale = 1f)

Gets glyph index and advance width for a codepoint.

public static int GetUpemFromFontData(byte[] fontData)

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 static float ComputeShapeParams(UniTextFontProvider fontProvider, int fontId, out int spacingOffsetUnits, out float fakeBoldAdvancePx)

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