Skip to content

Function: resolveTextTransform() ​

ts
function resolveTextTransform(font): TextTransform;

Experimental

The text transform and size scale for a font's textcase and variant, applied in that order (CSS applies text-transform before font-variant-caps).

Variants are approximated. True small caps draw lowercase letters as small capitals next to full-size capitals, which needs per-glyph sizes inside one label; troika sizes a label as a whole, so this has to wait for rich-text runs (E2.10). Until then the whole label is uppercased and drawn at a reduced size: SMALL_CAPS_SCALE for small-caps / all-small-caps, PETITE_CAPS_SCALE for petite-caps / all-petite-caps; unicase uppercases at full size. The metrics oracle and the text primitive both use this function, so layout matches what is drawn.

Parameters ​

ParameterType
font{ textcase?: TextFontTextCase; variant?: TextFontVariant; }
font.textcase?TextFontTextCase
font.variant?TextFontVariant

Returns ​

TextTransform

Released under the MIT License.