Table of Contents

Class StyleFontClass

Namespace
Velvet
Assembly
Velvet.Docs.dll

Parses Velvet's font utility classes — font-<name> (family), font-thinfont-black (weight), italic / not-italic / bold-italic (style), plus the arbitrary font-[…] forms — into a single FontIntent. Mirrors Velvet.StyleGapClass's whole-array, last-wins extraction so it slots into the reconciler the same way. Resolution to actual assets/styles is done by StyleFontResolver.

public static class StyleFontClass
Inheritance
object
StyleFontClass

Methods

HasFontClass(string[])

Cheap early-out: true when ANY class is a font utility. Avoids the full TryExtract(string[], out FontIntent) scan on the elements (the vast majority) that carry no font class.

IsArbitraryFontClass(string)

True when cls is an arbitrary font class (font-[…]). These are owned by StyleFontResolver (resolved from the whole class array and applied as inline style), so the reconciler must keep them out of the USS class list — unlike the non-bracket font classes (font-bold, font-sans, …) which stay in the list as the USS fallback. Single source of truth for the AddClass / RemoveClass / ApplyClassNames exclusion checks. Routed through Velvet.StyleArbitraryValueResolver.StripImportant(string, out bool) first so an important-modifier bang (!font-[…] / font-[…]!) is tolerated: the 3 call sites above run THIS check before their own StripImportant call, so a bang'd token that only matched the un-prefixed form would fall through, have its bang stripped downstream, and leak the bare bracket core into the class list as a dead token. The modifier itself stays a no-op for this family either way (see StripImportant's own Scope comment) — this only makes the classlist guard agree with the stripper on what counts as "this family".

IsFontToken(string)

Whether cls can change what TryExtract(string[], out FontIntent) builds. Both readers ask it as a cheap over-approximation and pay only a wasted resolve for a false positive — the presence gate below decides whether to run the resolver at all, and StyleVariantPayload.IsVariantGateToken decides whether to track a payload for it. Reading the font- prefix rather than the parse is what keeps it on the cheap side of that trade: a suffix TryExtract(string[], out FontIntent) goes on to reject still enters, where a spelling this failed to recognise would cost the payload its effect.

TryExtract(string[], out FontIntent)

Scans classNames and folds every font utility into one FontIntent. Each facet (family / weight / italic) follows CSS cascade order: a later class of the same facet overrides an earlier one. Returns false when no font class is present.