> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Fonts

Fonts decide how wide a column of text is, where wrapped text breaks and how tall a row grows. If text is measured with a font that has different widths than the fonts Microsoft Excel uses, a PDF or PNG differs from what Microsoft Excel shows. Read this page before you deploy.

## How fonts are chosen

The renderer asks a **font registry** for each family name in the workbook (`Calibri`, `Aptos`, `Arial` …). The registry gives a face, or a fallback.

`@reductoai/portable-fonts` ships a **portable profile**: open fonts with the same metrics as the Office fonts, such as Carlito for Calibri and Liberation Sans for Arial, plus fallbacks for CJK and other scripts.

## Node

`toPdf` and `toPng` register fonts the first time they paint:

1. If `DOCX_FONT_MIRROR` is set, they use the portable profile plus the faces in that folder.
2. Else, on a Mac with the Office fonts installed, they use those fonts. This gives the closest match to Microsoft Excel.
3. Else (Linux servers, CI), they use the portable profile and write one warning:

```text theme={null}
[docx] macOS oracle fonts not found; using the bundled portable profile ...
```

The warning is expected on a server. The output is deterministic: the same workbook gives the same pixels on every machine with the same profile.

## Browser

The grid needs a face provider before it paints. `@reductoai/xlsx-editor` sets one up for you: by default it loads the portable fonts from the npm CDN. To serve them yourself, copy `node_modules/@reductoai/portable-fonts/files` to your site and pass its URL:

```ts theme={null}
import { mountXlsxEditor } from "@reductoai/xlsx-editor";

mountXlsxEditor(document.getElementById("app")!, { workbook: bytes, fontsUrl: "/fonts" });
```

With `@reductoai/xlsx/view` alone, install the provider yourself. See [View](https://docs.reducto.ai/office/xlsx/rendering/view.md).
