Skip to content

IGlyphMetricsProvider

InterfaceTextStudioTextStudio
public interface IGlyphMetricsProvider

Backend-neutral source of per-character advance widths and kerning adjustments. Implemented by renderers that have font metrics available (e.g. the TextStudio.3D addon feeds a TTF outline provider), and consumed by TextStudio.TextStudioLayout to produce typographically correct layouts without the base package taking a hard dependency on any particular font format.

Values are expected in the same unit space TextStudio.TextStudioLayout uses for positions (typically EM-normalized units). TMP-based adapters normally do NOT supply a metrics provider since TMP’s own layout engine handles metrics upstream.

float GetAdvance(char c)

Advance width of a single character. Return 0 when the glyph is missing so the layout can fall back to a default spacing.

Parameters

Name Type
c System.Char

Returns

System.Single

float GetKerning(char left, char right)

Horizontal kerning adjustment between two adjacent characters. Negative values tighten the pair (e.g. AV, Te). Return 0 when the pair has no kern entry.

Parameters

Name Type
left System.Char
right System.Char

Returns

System.Single