[]previous and next page

FontFile

One font file, relative to the public directory.

One font file, relative to the public directory.

Import#

ts
import type { FontFile } from "@shadow-js/dusk/vite";

Signature#

ts
interface FontFile {
  /** Path under `public/`, for example `fonts/InstrumentSans.woff2`. No `..`, no backslash, no leading slash. */
  readonly file: string;
  /** Inferred from the extension when omitted (`woff2`, `woff`, `ttf`, `otf`). */
  readonly format?: FontFormat;
  /** A weight, or a range for a variable font (`"400 700"`). Default 400. */
  readonly weight?: string | number;
  readonly style?: "normal" | "italic";
  /** The width axis: `"75% 100%"` for a variable `wdth` axis. */
  readonly stretch?: string;
  readonly unicodeRange?: string;
  /**
   * Preload this file in the head. Default: the family's `preload`, else true, except for a file with a `unicodeRange`
   * (a slice of the family that is fetched only when its characters are used), which defaults to false.
   */
  readonly preload?: boolean;
}

Members#

Name Type Description
file readonly file: string Path under public/, for example fonts/InstrumentSans.woff2. No .., no backslash, no leading slash.
format? readonly format?: FontFormat Inferred from the extension when omitted (woff2, woff, ttf, otf).
weight? readonly weight?: string | number A weight, or a range for a variable font ("400 700"). Default 400.
style? readonly style?: "normal" | "italic"
stretch? readonly stretch?: string The width axis: "75% 100%" for a variable wdth axis.
unicodeRange? readonly unicodeRange?: string
preload? readonly preload?: boolean Preload this file in the head. Default: the family's preload, else true, except for a file with a unicodeRange (a slice of the family that is fetched only when its characters are used), which defaults to false.