@ctrliq/quantic-fonts
v1.72.0
Published
Readme
@ctrliq/quantic-fonts
Packaged Quantic webfonts with helpers for registering them.
Registering fonts
Each font exposes three registerers. Pick by rendering model:
import { inter, satoshi } from '@ctrliq/quantic-fonts';
inter.inject(); // client-only: appends a <style> to document.head
inter.css(); // server-rendered: returns @font-face text to inline
inter.preload(); // returns <link rel=preload> attributesPass a filter to narrow which variants load. Without one you ship all 40 files:
const FILTER = { weights: [400, 500, 600], styles: ['normal', 'italic'] } as const;
inter.css(FILTER);Serving the font files
css() and preload() reference fonts at a fixed URL path, so the build must serve the
packaged directory there. Both values come from the package:
import { FONT_ASSETS_URL_PATH, fontAssetsDir } from '@ctrliq/quantic-fonts/assets-dir';fontAssetsDir is an absolute path to the .woff2 files; FONT_ASSETS_URL_PATH is the
URL they must be served at. Wire them with whatever your bundler provides — Vite and
Astro use vite-plugin-static-copy, and other builds copy the directory directly.
