Skip to content

Function: fontSchema() ​

ts
function fontSchema(description): ObjectNode<{
  color: Attr<
    string,
    {
      description: 'Text color.';
      editType: 'style';
    }
  >;
  family: Attr<
    string,
    {
      description: 'CSS font-family list. The renderer uses the first family it can load and falls back through the list.';
      noBlank: true;
      strict: true;
    }
  >;
  lineposition: Attr<
    | 'under'
    | 'over'
    | 'through'
    | 'none'
    | `under+${string}`
    | `over+${string}`
    | `through+${string}`,
    {
      description: 'Text decoration: `under`, `over` and/or `through` joined with `+` (e.g. `under+over`), or `none`.';
      extras: readonly ['none'];
      flags: readonly ['under', 'over', 'through'];
    }
  >;
  shadow: Attr<
    string,
    {
      description: 'CSS `text-shadow` behind the text (`2px 2px 3px black`; only the first shadow is drawn), `none`, or `auto` for a thin halo in the contrast color of the text.';
    }
  >;
  size: Attr<
    number,
    {
      description: 'Font size in CSS pixels.';
      min: 1;
    }
  >;
  style: Attr<
    'normal' | 'italic',
    {
      description: 'Font style.';
      values: readonly ['normal', 'italic'];
    }
  >;
  textcase: Attr<
    'normal' | 'word caps' | 'upper' | 'lower',
    {
      description: 'Letter case transform: `upper`, `lower`, `word caps` (first letter of each word), or `normal`.';
      values: readonly ['normal', 'word caps', 'upper', 'lower'];
    }
  >;
  variant: Attr<
    'normal' | 'small-caps' | 'all-small-caps' | 'all-petite-caps' | 'petite-caps' | 'unicase',
    {
      description: 'Capitals variant (CSS `font-variant-caps`). The SDF text renderer approximates small and petite caps with uppercase letters at a reduced size.';
      values: readonly [
        'normal',
        'small-caps',
        'all-small-caps',
        'all-petite-caps',
        'petite-caps',
        'unicase',
      ];
    }
  >;
  weight: Attr<
    number | 'normal' | 'bold',
    {
      description: 'Font weight: a CSS numeric weight (1–1000), `normal` or `bold`.';
      extras: readonly ['normal', 'bold'];
      max: 1000;
      min: 1;
    }
  >;
}>;

Experimental

Font attributes without defaults. Containers like title.font inherit unset fields from layout.font during supply-defaults.

Parameters ​

ParameterType
descriptionstring

Returns ​

ObjectNode<{ color: Attr<string, { description: "Text color."; editType: "style"; }>; family: Attr<string, { description: "CSS font-family list. The renderer uses the first family it can load and falls back through the list."; noBlank: true; strict: true; }>; lineposition: Attr< | "under" | "over" | "through" | "none" | `under+${string}` | `over+${string}` | `through+${string}`, { description: "Text decoration: `under`, `over` and/or `through` joined with `+` (e.g. `under+over`), or `none`."; extras: readonly ["none"]; flags: readonly ["under", "over", "through"]; }>; shadow: Attr<string, { description: "CSS `text-shadow` behind the text (`2px 2px 3px black`; only the first shadow is drawn), `none`, or `auto` for a thin halo in the contrast color of the text."; }>; size: Attr<number, { description: "Font size in CSS pixels."; min: 1; }>; style: Attr<"normal" | "italic", { description: "Font style."; values: readonly ["normal", "italic"]; }>; textcase: Attr<"normal" | "word caps" | "upper" | "lower", { description: "Letter case transform: `upper`, `lower`, `word caps` (first letter of each word), or `normal`."; values: readonly ["normal", "word caps", "upper", "lower"]; }>; variant: Attr< | "normal" | "small-caps" | "all-small-caps" | "all-petite-caps" | "petite-caps" | "unicase", { description: "Capitals variant (CSS `font-variant-caps`). The SDF text renderer approximates small and petite caps with uppercase letters at a reduced size."; values: readonly ["normal", "small-caps", "all-small-caps", "all-petite-caps", "petite-caps", "unicase"]; }>; weight: Attr<number | "normal" | "bold", { description: "Font weight: a CSS numeric weight (1–1000), `normal` or `bold`."; extras: readonly ["normal", "bold"]; max: 1000; min: 1; }>; }>

Released under the MIT License.