Font Faces

A :fontFace token is what actually loads a font — declaring one compiles into a real @font-face rule in your exported code, not just the editor preview. Setting a fontFamily value only names a font; it doesn't load it. Self-hosted custom fonts are just one use.

Declaring Fonts

Declare custom fonts inside your token set using the first-class :fontFace composite token type. Nest your weights and styles cleanly as nested variant blocks.

Composite Font Declaration

A basic declaration defines the family and groups regular/bold variant sub-blocks.

Basic Font Declare a custom font family with nested variants.

Parent Family Inheritance

To keep token code DRY, nested :fontFace blocks automatically inherit the fontFamily declared in parent scopes.

Scope Inheritance Leverage automatic parent fontFamily lookup.

Parameters Reference

The :fontFace variant blocks support the following fields:

Required

src — The file source, wrapped in url() or asset(). Can also be a bracketed multi-format array [...], or google to load a hosted Google font (see below).

Optional & Defaults

fontFamily — Inherited from the parent scope or resolved globally if omitted.
fontWeight — Defaults to 400 (Regular) if omitted. Supports double-dot range notation [400..900].
fontStyle — Defaults to normal if omitted. Can be explicitly set to italic.
fontDisplay — swap, block, or fallback. Defaults to swap.

Google Fonts

Set src = google and the compiler builds the Google Fonts @import from your family and weights — you never hand-write a <link>.

Hosted Declaration

List the weights you want as [300, 600, 900] or a continuous range [300..900]. Add fontStyle = [normal, italic] to load italics too; leave it out for upright only.

Google Font Load a hosted Google font by family and weights.

What It Compiles To

Spaces in the family become +, weights join with ;, and italics pair each weight with an upright (0,) and an italic (1,) entry.

@import url("https://fonts.googleapis.com/css2?family=Iosevka+Charon:ital,wght@0,300;0,600;0,900;1,300;1,600;1,900&display=swap");

Referencing the Face

A face's fontFamily and its fontWeight list are referenceable, so you can declare the font once and alias it from your semantic tokens. In CSS and W3C exports these references are flattened to their value.

Reference a Face Alias a font-face's family and weights from semantic tokens.

Variable Fonts & Weight Ranges

Variable fonts support continuous weight variations. Use bracketed double-dot range notations to import them natively.

Variable Fonts Declare variable fonts with weight ranges using double-dot brackets.

Compiler Output

The compiler outputs standard, clean CSS @font-face definitions exactly once in their declaring stylesheet section.

/* --- Custom Imported Fonts --- */
@font-face {
  font-family: 'Array';
  src: url('//cdn.fontshare.com/wf/4QBZHM3FOPYBI67YBLLWZV6ZYIUQTKEE/RXSUFPNEA6YXGQDMHMP3OODY6UWXRJBM/C6VM2RT4EU2NNT5XZWVYHR7WOIOGM4EU.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Array';
  src: url('//cdn.fontshare.com/wf/UPIFVAOR6LZHAYRMF2C77WE3FN5BLNEC/INIDOMS2AGMFQXDWKOC6LOTPXKPZEIHL/2RWR7WKM4ZCDU656OKUXMQXLJH4H3EJD.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

Next: Output to code — W3C JSON, CSS Variables, download, and the CLI.