Skip to main content
Six variable fonts are bundled and registered automatically. Use them by name in font_family.
NameStyle
intersans
geistsans
geist-monomonospace
nunito-sanssans
robotosans
source-serif-4serif
{ type: "paragraph", text: "Body text", style: { font_family: "source-serif-4" } }

Weights

font_weight selects a real weight by instancing the variable font at build time. Names map to the usual axis values, and numbers pass straight through.
NameNumber
thin100
extralight200
light300
regular400
medium500
semibold600
bold700
extrabold800
black900
{ type: "paragraph", text: "Heavy", style: { font_family: "inter", font_weight: "black" } }
{ type: "paragraph", text: "Light", style: { font_family: "inter", font_weight: 300 } }
Markdown **bold** and the strong inline node also produce a real bold weight. See Inline content.
The bundled fonts are upright only, with no italic axis, so em and *italic* render the same glyphs as regular text. Use strong, **bold**, or a heavier font_weight for emphasis that is visible.

Custom variable fonts

Load a custom variable font with load_font and pass variable: true to enable weight instancing. Then use the registered name in font_family.
doc.load_font("my-sans", "./fonts/MySans.ttf", true);

doc.page().content(
  { type: "paragraph", text: "Custom font", style: { font_family: "my-sans", font_weight: "semibold" } },
);