UniTextFontProvider
Owns Unicode-sequence font resolution for a text object: composes the family chain from the assigned font and font stack, walks it (plus emoji and the always-on SystemFont fallback) to pick a covering runtime and exact variation instance when available, and otherwise returns the primary runtime as the intentional.notdef endpoint. Asset-backed faces are captured as worker-safe lazy slots; bare runtime companions and the emoji singleton flow through the same resolution path. The owner must dispose the provider after all processing and raster work finishes.
public static FontVariationMemoryStats VariationMemoryStats{ get }Returns a consistent snapshot of exact variation registrations and their ownership.
public UniTextFont.Core PrimaryFont{ get }Resolved primary font runtime. Provides strut metrics and serves as the head of codepoint resolution.
Stable id of PrimaryFont.
Equivalent to setting FontSize.
[ctor]public UniTextFontProvider(UniTextFont primary, UniTextFontStack fontStack, float fontSize = 36f, FontNormalizeMetric normalizeMetric = FontNormalizeMetric.None, float normalizeTarget = 0f)Initializes the provider. The resolution chain is primary (if set), then fontStack's families, then SystemFont.Default (the configured UniTextSettings.SystemFont or the OS default) as the always-on final fallback. With nothing assigned, SystemFont.Default becomes the primary. Main-thread only.
public float GetNormalizationScale(UniTextFont.Core font)Per-font multiplier matching a fallback/secondary font to the primary font's reference metric (CSS font-size-adjust). Derived from the runtime alone, so every id addressing one runtime — base or variation instance — yields the same multiplier. Returns 1 when normalization is off, the font is the primary, the font opts out, or a metric is unavailable.
Design-units → pixels for fontId at fontSize: folds in the font's UniTextFont.FontScale and the active normalization (CSS font-size-adjust). Multiply any design-unit metric (advance, bearing, line height) by the result. Returns 0 when the font is unavailable.
public float MetricScale(UniTextFont.Core font, float fontSize)Design-units → pixels for fontId at fontSize: folds in the font's UniTextFont.FontScale and the active normalization (CSS font-size-adjust). Multiply any design-unit metric (advance, bearing, line height) by the result. Returns 0 when the font is unavailable.
public void SetNormalization(FontNormalizeMetric metric, float target)Sets the active normalization metric and target, recomputing the primary reference ratio. Called by a font-size-match modifier so the provider stays modifier-agnostic.
public static int GetFontId(UniTextFont.Core font)Process-lifetime font identity. The primary system emoji face uses EmojiFont.FontId; null uses 0.
public static int GetFontId(UniTextFont font)Process-lifetime font identity from a UniTextFont asset.
public void RegisterFont(int fontId, UniTextFont.Core font)Registers a runtime under its process identity. Writes are serialized; reads stay lock-free.
public UniTextFont.Core GetFont(int fontId)Resolves a font id to its registered runtime, or null when the id has no owner in this provider.
Resolves a FontFamily.name to its primary font id, registering the runtime with this provider if needed. Returns 0 when the name is empty or unknown. Case-sensitive, first-wins across the family chain.
Same as FindFontForCodepoint but prefers families whose FontFamily.preferredLanguage matches the given language registry index.
