TwFontRole extension type

A semantic font role grouping three size variants of TwFontSize.

Mirrors TwColorFamily's extension-type pattern -- zero-cost at runtime, const-constructible, and record-backed.

TwTypeScale.headline.md  // -> TwFontSize(30, 1.2)
TwTypeScale.headline.resolve(TwTypeVariant.lg)  // -> TwFontSize(36, ~1.1111)
on

Constructors

TwFontRole({required TwFontSize sm, required TwFontSize md, required TwFontSize lg})
Creates a font role with three size variants.
const

Properties

lg → TwFontSize
The large variant.
no setter
md → TwFontSize
The medium variant.
no setter
sm → TwFontSize
The small variant.
no setter

Methods

resolve(TwTypeVariant variant) → TwFontSize
Returns the TwFontSize for the given variant.