Custom typography is a core part of most image designs. Grafex supports font loading through theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/andresilva-cc/grafex/llms.txt
Use this file to discover all available pages before exploring further.
fonts field in CompositionConfig, which accepts an array of CSS stylesheet URLs. Each entry is injected as a <link rel="stylesheet"> tag in the HTML <head> before rendering, so Google Fonts URLs and any other CSS-serving endpoint work directly. Once loaded, the fonts are available anywhere in your composition — just reference the family name in your fontFamily style as you would in any web page.
Loading fonts via config.fonts
Add afonts array to your config with one entry per font source. Each entry is passed to the browser as a stylesheet reference, so Google Fonts URLs and other CSS-serving endpoints work directly:
Inter wherever fontFamily references it. The fallback chain (system-ui, sans-serif) ensures the composition still renders legibly if the font URL is unreachable.
Loading multiple fonts
Pass multiple entries to load several families or weights at once:Self-hosted fonts via CSS @font-face
If you prefer to keep font files local — for offline builds, CI environments without internet access, or proprietary typefaces — define them with@font-face in an external CSS file and load that file via config.css instead of config.fonts.
fonts.css:
card.tsx:
url() references inside fonts.css are treated as local asset paths — Grafex embeds the .woff2 files as base64 data URLs automatically, so the font is available even without a file server. See Local Images for details on how local asset embedding works.
Fonts in variants
Thefonts array in a variant replaces the base config’s fonts array entirely — there is no merging. If a variant needs a different or additional font, list all required sources in that variant’s fonts field:
default variant uses Inter. The mono variant uses only JetBrains Mono — the base Inter URL is not included unless you add it explicitly to the mono variant’s array.