# Fonts & Colour Emoji

> For AI agents: a documentation index is available at https://makespdf.com/llms.txt — every docs page also has a markdown twin (append .md to the page URL), including this one: https://makespdf.com/docs/fonts.md

Every PDF makesPDF renders is self-contained: the fonts it uses are embedded and
subsetted, so the document looks the same on any machine, in any viewer, years
later. This page lists what ships, how characters that a font lacks still
render, and how to bring your own fonts.

## Fonts that ship

Four base families are embedded in every render, and the fallback sets below
load on demand only when a document needs them — nothing needs to be installed
or fetched by you:

- **Inter** — the default across markdown and templates. Regular, SemiBold
  (what `font-weight: bold` resolves to), Bold and Italic.
- **NotoSans** — a humanist alternative, selectable with `fontFamily: "NotoSans"`
  on `/md` or `font-family` in a template. Ships Regular, Bold and Italic;
  `font-weight: bold` draws the Bold face.
- **Cousine** — monospace, used for code blocks and `inline code`.
- **NotoSansSymbols2** — a symbol subset loaded on demand (checkboxes, bullets,
  arrows — the ☑/☐ in task lists, long → arrows).
- **Noto Sans SC / TC / JP / KR** — Chinese, Japanese and Korean draw with these
  automatically; only the unicode-range slices covering your document's
  characters load (see *CJK* below).
- **Noto Sans Hebrew** — Hebrew draws with this automatically, right-to-left;
  Regular and Bold, loaded only for documents that contain Hebrew (see *Hebrew*
  below).
- **Noto Sans Avestan** — Avestan draws with this automatically, right-to-left,
  loaded only for documents that contain it (see *Right-to-left scripts* below).
- **Noto Sans Inscriptional Pahlavi** — Inscriptional Pahlavi draws with this
  automatically, right-to-left, loaded only for documents that contain it.

## Per-character fallback

A character the current font doesn't have is drawn by the first font that does,
character by character and grapheme cluster by grapheme cluster — the run is
split silently, keeping size, colour, weight and decoration. Skin-tone
modifiers, joiners (ZWJ), variation selectors, flags and keycaps are never split
apart: a whole emoji sequence is resolved as one unit.

If no available font covers a character it is drawn blank and the render reports
it as a layout warning (`glyph-missing`, naming the codepoints and a count —
never your text). In practice that means an unsupported script, not a stray
symbol; see [the API reference](https://makespdf.com/docs/api) for where warnings appear.

The coverage sets this is based on are assembled at render time and only the
fallbacks a document actually needs are loaded — a page of plain Latin text
never pays for the colour emoji font, and a document with no symbols never loads
the symbol subset.

## CJK

Chinese, Japanese and Korean render with no font upload, on every endpoint —
markdown, templates and canvas boards alike. The renderer picks a script and
loads only the unicode-range slices covering the document's CJK characters, so a
short Japanese paragraph pulls a few hundred KB, and a document with no CJK text
loads nothing.

Set the script with the `lang` option (a
[BCP 47](https://www.rfc-editor.org/info/bcp47) tag): `ja` → Japanese, `ko` →
Korean, `zh`, `zh-Hans`, `zh-CN`, `zh-SG` → Simplified Chinese, and `zh-Hant`,
`zh-TW`, `zh-HK`, `zh-MO` → Traditional Chinese. `lang` also writes the PDF's
`/Lang`, which screen readers and accessibility checkers use to pronounce the
text correctly. Without a `lang`, the text itself decides: any kana means
Japanese, any Hangul means Korean, and Han-only text is treated as Simplified
Chinese — so pass `zh-Hant` for Traditional Chinese text that carries no kana or
Hangul.

A `font-family` you name still wins for the characters it covers: the built-in
CJK fonts are a fallback, not an override. Cyrillic, Greek, Vietnamese, Georgian
and Armenian still need a custom font (below). Hebrew, Avestan and Inscriptional
Pahlavi render with no font upload; Arabic, Persian and Urdu still need shaping
(below).

## Right-to-left scripts

Hebrew, Avestan and Inscriptional Pahlavi render right-to-left with no font
upload, on every endpoint — markdown, templates and canvas boards alike. Each
line is ordered by the Unicode bidi algorithm (UAX #9): a line whose first strong
character is right-to-left is right-aligned and drawn right to left, mixed Latin
and number runs keep their own left-to-right order inside it, and brackets are
mirrored. Each script's face loads only when the document contains that script's
characters, so a Latin page pays nothing.

All three are non-joining scripts — every letter is a standalone glyph, with no
contextual forms — which is what makes them work today: Arabic, Persian and Urdu
need OpenType joining that the layout engine does not implement yet, so their
text is drawn in logical order rather than reversed.

**Hebrew** ships as **Noto Sans Hebrew** Regular and Bold, and a bold Hebrew run
picks the Bold face. Unpointed Hebrew is in scope; *pointed* text (niqqud) needs
mark positioning that the character-by-character glyph path does not do, so its
vowel points come out as their own glyphs rather than positioned marks.

**Avestan** and **Inscriptional Pahlavi** ship as **Noto Sans Avestan** and
**Noto Sans Inscriptional Pahlavi** — Regular only, as upstream publishes no bold
cut, so a bold run keeps the regular weight. Avestan uses `U+2E31` (word
separator middle dot) between words and so does the font, so it draws correctly.

Copy and paste gives the source order: a reordered line carries its logical text
in an `/ActualText` marker, so selecting it and copying returns what you wrote,
not the visual glyph order, and `pdftotext` extracts it that way too. On a page
that reads right to left the marker carries an invisible left-to-right mark so
the text is not flipped back; a line that mixes Hebrew with Avestan or
Inscriptional Pahlavi is left to the extractor's own bidi, so keep those scripts
in separate paragraphs when logical copy-paste matters.

## Colour emoji

Emoji render in full colour, drawn as native vector graphics rather than images.
They work anywhere text works: markdown paragraphs and headings, lists and task
lists, tables, bold / italic / coloured runs, links, and canvas cards.
Multi-codepoint sequences are supported — ZWJ families (👨‍👩‍👧‍👦), skin-tone modifiers
(👍🏽), regional-indicator flags (🇦🇺), keycaps (1️⃣), heart-on-fire (❤️‍🔥) and
tag-sequence subdivision flags.

Each emoji is one glyph for layout purposes — the advance width is its em box, so
line breaking and alignment treat an emoji like any other character of that
size. For copy / paste and screen readers, each emoji extracts as exactly one
emoji: the PDF carries an `/ActualText` marker naming the sequence, so a family
of four is not read out as four separate people.

Colour emoji come from the **Twemoji Mozilla** colour font (the COLRv0 build of
[mozilla/twemoji-colr](https://github.com/mozilla/twemoji-colr)), used under its
open licences: the build is Apache-2.0, and the artwork is **Twemoji by
Twitter/X, licensed CC-BY 4.0** —
[creativecommons.org/licenses/by/4.0](https://creativecommons.org/licenses/by/4.0/).
The font is fetched only when a document contains an emoji, and the renderer
paints its coloured layers directly into the PDF — no external images, no
runtime text-shaping engine.

## Custom fonts

Both `POST /api/v1/preview` and `POST /api/v1/render` accept a `fonts` array:
each family names TTF or OTF variants by `https://` URL, and they are fetched,
subsetted and embedded per request. Register a family, then reference it from
`font-family`:

```json
{
  "dsl": "const template = doc({}, page(col(s(\"Hello\", { class: \"brand\" }))));\nconst sampleData = {};",
  "fonts": [
    {
      "family": "Brand",
      "variants": [
        { "src": "https://cdn.example.com/Brand-Regular.ttf" },
        { "src": "https://cdn.example.com/Brand-Bold.ttf", "weight": "bold" }
      ]
    }
  ]
}
```

Limits: 4 families per request, 6 variants per family, 5 MB per file. Variant
selection follows `font-weight` / `font-style`; families that collide with the
embedded names above are rejected. Fetched files are cached (keyed by URL hash),
so repeat renders don't re-download. Uploaded fonts are the supported path for
non-Latin European scripts (Cyrillic, Greek, Vietnamese, Georgian, Armenian) —
and the way to render CJK with a branded typeface.

Hebrew, Avestan and Inscriptional Pahlavi render right-to-left with no font
needed (their faces ship as fallbacks and load only for documents that contain
them). Arabic, Persian and Urdu are not yet supported: they need contextual
joining forms (OpenType GSUB), so their text is drawn in logical order rather
than reordered. Indic, Thai, Khmer and Burmese need shaping and dictionary-based
breaking, which the pipeline does not have either.

## Licences

The embedded fonts are open source: Inter (SIL Open Font License 1.1), Noto
Sans, Noto Sans CJK SC/TC/JP/KR, Noto Sans Hebrew, Noto Sans Avestan, Noto Sans
Inscriptional Pahlavi and NotoSansSymbols2 (SIL OFL 1.1), Cousine
(Apache License 2.0), and Twemoji Mozilla (Apache-2.0 build; Twemoji artwork
CC-BY 4.0, attributed above). The fallback fonts ship their licence files
beside the fonts themselves in the repository (the colour emoji font, Noto Sans
Hebrew and the two Iranian-script faces), and attribution for the Twemoji
artwork is reproduced here and in the project documentation.

## Where to next

[Markdown to PDF](https://makespdf.com/docs/markdown) for the supported syntax,
[the template DSL](https://makespdf.com/docs/dsl) for `font-family` and text styles in
templates, or [the API reference](https://makespdf.com/docs/api) for the endpoints'
authentication, limits and response shapes.
