Custom Fonts
The fonts object registers custom font families from uploaded font files. Once registered, a font family can be referenced by name in any style definition using the fontFamily property.
Text with no fontFamily is set in the engine's built-in sans, which has Arial's metrics and is embedded like any other face, so a render never depends on the fonts installed where it runs.
Registering a font family
Declare fonts at the document level with a family name and paths to each variant:
{
"document": {
"fonts": {
"Roboto": {
"regular": "fonts/Roboto-Regular.ttf",
"bold": "fonts/Roboto-Bold.ttf",
"italic": "fonts/Roboto-Italic.ttf",
"boldItalic": "fonts/Roboto-BoldItalic.ttf"
}
},
"styles": {
"body": { "fontFamily": "Roboto", "fontSize": 10 }
},
"content": [
{ "p": "This text renders in Roboto.", "style": "body" }
]
}
}
A font path is looked up in your workspace's assets first, then among the files the platform publishes for every workspace. The faces the starter templates name — fonts/NotoSerif-Regular.ttf, fonts/GreatVibes-Regular.ttf and the others — are published, so a starter renders in its own faces with nothing uploaded. Upload a font only for a face of your own; a file of yours with the same path takes precedence. A declared file that is found in neither place is reported as FONT_NOT_LOADED in the response's errorCodes.
Font family properties
| Property | Type | Required | Description |
|---|---|---|---|
regular | string | Yes | Path to the regular weight font file |
bold | string | No | Path to the bold weight font file |
italic | string | No | Path to the italic font file |
boldItalic | string | No | Path to the bold-italic font file |
fontFeatureValues | object | No | Names for the family's alternate glyphs, which fontVariantAlternates asks for |
Only regular is required. A missing variant is found as CSS finds it: a bold-italic run takes the italic face when there is one, else the bold, else the regular, and whatever that face lacks is synthesised (bold by stroking the glyphs, italic by slanting them), with a notice in the render report. Set fontSynthesis in the style to refuse that: "none" draws the chosen face as it is.
Naming a family's alternates
A face numbers its alternate glyphs its own way: swash 1 is a Q in one face and an ampersand in another. So a family names
the ones it means in fontFeatureValues, and a style asks for them by name with
fontVariantAlternates. A style that names an alternate its
family does not declare draws the face's default, so one style can serve several families.
| Member | Each name takes | Turns on |
|---|---|---|
stylistic | one number | the face's stylistic alternates (OpenType salt) |
styleset | one or more numbers, 1 to 99 | stylistic sets ss01 to ss99 |
characterVariant | [index] or [index, value], index 1 to 99 | character variant cv01 to cv99, set to the value (1 if none) |
swash | one number | swash glyphs (swsh, cswh) |
ornaments | one number | ornaments (ornm) |
annotation | one number | annotation forms such as circled figures (nalt) |
{
"document": {
"fonts": {
"Script": {
"regular": "fonts/GreatVibes-Regular.ttf",
"fontFeatureValues": { "styleset": { "capitals": [1], "loops": [2] }, "stylistic": { "flourish": 1 } }
},
"Code": {
"regular": "fonts/JetBrainsMono-Regular.ttf",
"fontFeatureValues": { "characterVariant": { "single-g": [3], "curly-l": [1] } }
}
},
"styles": {
"names": { "fontFamily": "Script", "fontSize": 22, "fontVariantAlternates": "styleset(capitals, loops)" },
"code": { "fontFamily": "Code", "fontVariantAlternates": "characterVariant(single-g, curly-l)" }
},
"content": [
{ "p": "Charlotte Ashford & Benedict Zeller", "style": "names" },
{ "p": "let tally = kind.rules().count();", "style": "code" }
]
}
}
A name is a letter, then letters, digits, - or _, and is case-sensitive. A declaration a member's rule does not allow
(a character variant past 99, two numbers for a swash) is ignored and reported.
Uploading font files
Upload font files to your tenant's asset storage:
POST /v1/{tenantId}/assets/fonts
Content-Type: multipart/form-data
file: Roboto-Regular.ttf
Supported formats: .ttf (TrueType) and .otf (OpenType). Fonts are embedded, subset to the glyphs drawn, in the PDF and in the DOCX, as far as the face's licence (its embedding permissions) allows: a face that forbids embedding is refused and reported, and one that forbids subsetting goes in whole. A .ttc collection is read by its first face, with a notice naming it.
Using in styles
Reference the registered family name in any style's fontFamily property:
{
"fonts": {
"NotoSerif": {
"regular": "fonts/NotoSerif-Regular.ttf",
"bold": "fonts/NotoSerif-Bold.ttf",
"italic": "fonts/NotoSerif-Italic.ttf",
"boldItalic": "fonts/NotoSerif-BoldItalic.ttf"
}
},
"styles": {
"title": { "fontFamily": "NotoSerif", "fontSize": 22, "fontWeight": "bold" },
"body": { "fontFamily": "NotoSerif", "fontSize": 11 },
"bodyItalic": { "fontFamily": "NotoSerif", "fontSize": 11, "fontStyle": "italic" },
"caption": { "fontFamily": "NotoSerif", "fontSize": 8, "fontStyle": "italic" }
}
}
The bold, italic, and boldItalic style flags select the corresponding variant from the registered family.
Inline formatting
Shortcodes ([b], [i], [bi]) use the correct font variant automatically:
{ "p": "Regular text with [b]bold emphasis[/b] and [i]italic notes[/i].", "style": "body" }
If the style's font is NotoSerif, [b] renders with NotoSerif-Bold.ttf, [i] with NotoSerif-Italic.ttf, and so on.
Mixing custom and standard fonts
Custom fonts and the built-in sans coexist in the same document. Styles without a fontFamily property use the built-in sans:
{
"fonts": {
"NotoSerif": { "regular": "fonts/NotoSerif-Regular.ttf" }
},
"styles": {
"body": { "fontFamily": "NotoSerif", "fontSize": 11 },
"footnote": { "fontSize": 8, "color": "#999999" }
},
"content": [
{ "p": "Serif body text.", "style": "body" },
{ "p": "Sans-serif footnote in the built-in sans.", "style": "footnote" }
]
}
Partial families
If you only have the regular weight, register just that file:
{
"fonts": {
"BrandFont": {
"regular": "fonts/BrandFont-Regular.ttf"
}
}
}
Bold, italic, and boldItalic runs are then drawn from the regular file, emboldened or slanted by synthesis, and the render report notes it. A style with "fontSynthesis": "none" draws them upright and at the regular weight instead.
Full example
{
"document": {
"metadata": { "title": "Custom Font Report" },
"fonts": {
"NotoSerif": {
"regular": "fonts/NotoSerif-Regular.ttf",
"bold": "fonts/NotoSerif-Bold.ttf",
"italic": "fonts/NotoSerif-Italic.ttf",
"boldItalic": "fonts/NotoSerif-BoldItalic.ttf"
}
},
"styles": {
"title": { "fontFamily": "NotoSerif", "fontSize": 20, "fontWeight": "bold" },
"body": { "fontFamily": "NotoSerif", "fontSize": 11 },
"caption": { "fontFamily": "NotoSerif", "fontSize": 8, "fontStyle": "italic", "color": "#888888" }
},
"content": [
{ "h1": "Quarterly Report" },
{ "p": "This report uses Noto Serif throughout for a traditional, readable appearance.", "style": "body" },
{ "p": "Key metrics are highlighted with [b]bold[/b] and supplementary notes in [i]italic[/i].", "style": "body" },
{
"table": {
"widths": [3, 1, 1],
"rows": [
[{ "p": "Department", "style": "title" }, { "p": "Q1", "style": "title" }, { "p": "Q2", "style": "title" }],
[{ "p": "Engineering", "style": "body" }, { "p": "$1.2M", "style": "body" }, { "p": "$1.4M", "style": "body" }],
[{ "p": "Marketing", "style": "body" }, { "p": "$800K", "style": "body" }, { "p": "$950K", "style": "body" }]
]
}
},
{ "p": "Source: internal finance systems. Figures are unaudited.", "style": "caption" }
]
}
}
Multi-script & complex text
Registered fonts are shaped at render time with OpenType shaping, as a browser shapes them. Complex scripts render correctly straight from JSON, with no client-side rendering:
- Right-to-left — Arabic, Persian, and Hebrew letters join into their initial/medial/final/isolated forms and set right-to-left automatically.
- Indic — Devanagari conjuncts (क्ष, श्र), Bengali, Gujarati, Gurmukhi, Kannada, Malayalam, Oriya, Tamil and Telugu render with correct ligature stacking and vowel positioning.
- Southeast and Central Asian — Khmer, Lao, Myanmar, Tibetan and Mongolian shape from their own faces.
- Canadian Aboriginal syllabics — Inuktitut, Cree and Ojibwe text render from Noto Sans Canadian Aboriginal, regular and bold, the extended blocks included.
- Ethiopic — Amharic, Tigrinya and Ge'ez render from Noto Sans Ethiopic, regular and bold; the bars above and below an Ethiopic number join from its first digit to its last.
- Thai — above/below vowel marks and tone marks position correctly.
- CJK — Chinese, Japanese, and Korean render from a single Noto Sans CJK family.
- Latin / Cyrillic / Greek — Noto Sans covers extended Latin, Cyrillic, and Greek alongside the default font.
- Geometric symbols — Noto Sans Symbols 2 covers geometric shapes, dingbats, and misc Unicode symbols (▲ ▼ ◆ ✓ ★) with no configuration.
- Numbers in a circle — written as the number in a clipped inline box, in the document's own font: see Numbers in a circle. Squared units and other CJK compatibility characters (㎏ ㎥ ㈱) are CJK text and render with it.
- Math & technical — Noto Sans Math covers arrows, math operators, and technical symbols (→ ← ≥ ≤ ≠ ∞ etc.) automatically.
The following fonts are bundled and applied automatically with no registration:
| Script / category | Vendored font | Bold |
|---|---|---|
| Arabic, Persian | Noto Sans Arabic | yes |
| Hebrew | Noto Sans Hebrew | yes |
| Armenian | Noto Sans Armenian | yes |
| Devanagari (Hindi, Marathi, Nepali, Sanskrit) | Noto Sans Devanagari | yes |
| Bengali | Noto Sans Bengali | yes |
| Gujarati | Noto Sans Gujarati | yes |
| Gurmukhi (Punjabi) | Noto Sans Gurmukhi | yes |
| Oriya (Odia) | Noto Sans Oriya | yes |
| Tamil | Noto Sans Tamil | yes |
| Telugu | Noto Sans Telugu | yes |
| Kannada | Noto Sans Kannada | yes |
| Malayalam | Noto Sans Malayalam | yes |
| Thai | Noto Sans Thai | yes |
| Lao | Noto Sans Lao | yes |
| Khmer | Noto Sans Khmer | yes |
| Myanmar (Burmese) | Noto Sans Myanmar | yes |
| Tibetan | Noto Serif Tibetan | yes |
| Mongolian | Noto Sans Mongolian | regular only |
| Canadian Aboriginal syllabics (Inuktitut, Cree, Ojibwe) | Noto Sans Canadian Aboriginal | yes |
| Ethiopic (Amharic, Tigrinya, Ge'ez) | Noto Sans Ethiopic | yes |
| Chinese, Japanese, Korean | Noto Sans CJK SC | yes |
| Greek, Cyrillic (Russian, Ukrainian, Bulgarian…), Latin Extended | Noto Sans | yes |
| Geometric symbols, dingbats (▲ ▼ ◆ ✓ ★) | Noto Sans Symbols 2 | regular only |
| Math operators, arrows (→ ≥ ≤ ≠ ∞) | Noto Sans Math | regular only |
Where a script's face has no bold, a bold run is drawn from the regular face.
A script this table does not list needs a font you declare. Without one, its characters are left out of the page and reported as GLYPH_NOT_DRAWN in errorCodes, naming each character.
Equations are set in their own math faces, also bundled: Latin Modern Math, with STIX Two Math drawing any character Latin Modern Math lacks. Text outside an equation never uses them.
Two additional faces ship with the engine but are never applied by themselves: Font Awesome icons and MICR E-13B (the magnetic-ink routing/account line on bank cheques). Declare them like any family, with a vendored/ path in place of a file of your own, then use them by fontFamily or [font, Family]…[/font]:
{
"fonts": {
"MICR": { "regular": "vendored/MICR-E13B-Regular.ttf" },
"Icons": { "regular": "vendored/fa-solid-900.otf" }
}
}
A vendored/ name the engine does not ship is reported, naming the ones it does, and the family is skipped.
For all automatic fonts, just write the text — script detection is automatic. No font registration needed unless you want a specific face.
When you do register a font and reference it via fontFamily in a style or [font, Family]…[/font] inline, it takes precedence over the vendored fallback for the characters it covers.
fontFamily draws what it coversWhen a style sets fontFamily, that family draws every character it has. A run in a script the family does not cover falls to the built-in face for that script, so mixed-script text still renders. In a DOCX, Word substitutes a face of its own for such a run. To choose a specific face for the other script, register it and switch explicitly with [font, Family]…[/font]:
{
"fonts": {
"Serif": { "regular": "fonts/NotoSerif-Regular.ttf" },
"Arabic": { "regular": "fonts/NotoSansArabic-Regular.ttf", "bold": "fonts/NotoSansArabic-Bold.ttf" }
},
"styles": {
"feat": { "fontFamily": "Serif", "fontSize": 13 }
},
"content": [
{ "p": "Filed by [font, Serif]$data.counsel.name[/font] · [font, Arabic]صالح عالميا[/font]", "style": "feat" }
]
}
Paragraphs whose style has no fontFamily benefit from automatic script detection too — no inline tags needed.
Embedding and subsetting
Fonts embed automatically, and large fonts stay cheap: a Noto Sans CJK file is ~16 MB on disk, but only the glyphs actually used are embedded — a document using a handful of CJK characters adds a few kilobytes, not megabytes. Every face is subset to the glyphs it draws, shaped scripts included (the contextual forms shaping reaches are kept), in the PDF and in the DOCX.
See it in action
The Multilingual Proclamation tutorial renders 25 languages across 8 writing systems in one document — multi-script seal, inline font switching, page breaks, and five barcode symbologies — entirely from declarative JSON.
The Multilingual Device Guide takes the harder case: full safety prose in Chinese, Japanese, Korean, Hindi and Thai — Devanagari conjuncts and Thai tone stacking in running sentences, not just labels — with the whole CJK family delivered by subsetting.
Numbers in a circle
Numbered forms, legends and step lists often want a number inside a circle. Write the number itself in a named style's inline box and clip the box — any number, any colour, in the font the rest of the line uses:
{
"styles": {
"boxLabel": { "fontSize": 8, "fontWeight": "bold", "color": "#A93226" },
"num": { "color": "#FFFFFF", "fontWeight": "bold", "backgroundColor": "#1A1A1A", "padding": "0.5 2.5", "clipPath": "ellipse()" }
},
"content": [
{ "p": "[span, num]1[/span] SENDER", "style": "boxLabel" },
{ "p": "[span, num]18[/span] CARRIER'S RESERVATIONS", "style": "boxLabel" }
]
}
[span, style] draws the run in the style's box: its backgroundColor, padding, border, borderRadius and clipPath. ellipse() fits the box whatever the number's width; circle(), polygon(...) and inset(...) give a disc, a diamond or a rounded square.
The Unicode characters that carry a number inside a circle (① ❶ ➀ ⑴ ⓐ, U+2460–U+24FF and U+2776–U+2793) are not drawn: no shipped text face carries them, they stop at 20 or 50, and they offer no shape but the circle. A document that types one gets a warning naming the character. Squared units and the other characters of the CJK compatibility blocks (㎏ ㎡ ㈱, U+3200–U+33FF) are CJK text and render wherever the CJK faces are available.
Special & display faces
Beyond text fonts, registered families can be domain-specific or display faces — handled identically (register, then reference by fontFamily or switch inline with [font, Family]):
- Blackletter — diploma and certificate mastheads, ornamental titles.
- Signature script — hand-signed names on letters, awards and approvals.
- Handwriting — reviewer annotations, informal callouts, margin notes.
- Monospace — code listings, checksums, column-aligned figures.
- OCR-B — passport machine-readable zone (MRZ) and OCR form fields.
- MICR E-13B — the magnetic-ink routing/account/check band on bank checks, declared with its
vendored/path as shown above.
The Type Specimen tutorial shows each of these in a realistic context, all embedded straight from JSON.
Notes
- Font files are embedded, subset, in the generated PDF and DOCX. Recipients do not need the fonts installed.
- Fonts are loaded once per document generation and cached for the duration of the render.
- If a family's regular file is missing or unreadable, the family is skipped, styles referencing it fall back to the built-in sans, and
FONT_NOT_LOADEDis reported. A missing bold or italic file is reported with the same code, and the family's other faces stand in for it. - Font family names are case-insensitive:
"NotoSerif"and"notoserif"resolve to the same family.