> ## 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.

# @reductoai/pptx/browser

Fonts and picture backends in a page or a worker. See [JS API in the browser](https://docs.reducto.ai/office/pptx/js-api/browser.md).

## `portableFaceProvider()`

```ts theme={null}
function portableFaceProvider(urlFor: (file: string) => string): TableFaceProvider
```

The portable profile served as static files from `urlFor(file)`. Lazy: the
first document pulls the faces it uses (a Calibri letter costs Carlito's four
files, about 1 MB), not the 16 MB profile.

Import from `@reductoai/pptx/browser`.

## `tableFaceProvider()`

```ts theme={null}
function tableFaceProvider(
  source: FaceTable | (() => Promise<FaceTable>),
  urlFor: (file: string) => string,
): TableFaceProvider
```

Lazy, content-addressed faces served as plain files. `install` costs the
table alone; each face downloads once, the first time a document needs it,
and stays for the session. A face that fails to download is left absent, so
layout falls back exactly as it would on a machine missing that font.

Import from `@reductoai/pptx/browser`.

## `FaceProvider`

How face bytes reach the browser. `FaceSource.bytes()` is synchronous, so a
layout cannot fetch mid-run; `layoutDocxInBrowser` lays out once to trace
the faces it needs, calls `fetch` with those ids, and lays out again when
bytes arrived. `bytes` serves canvas `FontFace` loading and PDF embedding.

Import from `@reductoai/pptx/browser`.

| Name | Type | Description |
| - | - | - |
| `bytes()` | `(id: string) => Uint8Array<ArrayBufferLike> \| null` | Face bytes held here, or an embedded face the registry extracted. |
| `fetch()` | `(ids: string[], onProgress?: FetchProgress) => Promise<number>` | Pull the faces named by `ids` that are not held yet; returns the bytes pulled. |
| `heldIds()` | `() => string[]` | Ids whose bytes this thread holds; a worker skips these when it ships faces over. |
| `install()` | `() => Promise<void>` | Register every family on `defaultFontRegistry`; face bytes may still be absent. Memoized. |
| `seed()` | `(faces: Iterable<[string, Uint8Array<ArrayBufferLike>]>) => void` | Adopt face bytes another thread fetched, so `bytes` can serve them here. |

## `installBrowserMetafileBackend()`

```ts theme={null}
function installBrowserMetafileBackend(opts: BrowserMetafileOptions): MetafileBackend
```

Install the browser metafile backend and return it. Safe to call once per
page; a later call replaces the backend.

Import from `@reductoai/pptx/browser`.

## `serveMetafileRaster()`

```ts theme={null}
function serveMetafileRaster(opts: MetafileWorkerOptions): void
```

Serve raster requests on this worker's scope until it is terminated.

Import from `@reductoai/pptx/browser`.

## `installBrowserSvgRasterizer()`

```ts theme={null}
function installBrowserSvgRasterizer(opts: BrowserSvgOptions): void
```

Route PPTX SVG pictures through the metafile backend. Text SVGs from
PowerPoint charts resolve their faces by name inside resvg, so the backend's
per-job face fetch is the only thing that puts glyphs on the canvas.

Import from `@reductoai/pptx/browser`.

## `BrowserSvgOptions`

Import from `@reductoai/pptx/browser`.

| Name | Type | Description |
| - | - | - |
| `backend` | `MetafileBackend` | The installed metafile backend; it owns the font fetch and the worker pool. |
| `defaultFontFamily?` | `string` | Family resvg uses for text whose named faces the host cannot supply. |
| `probe` | `(svg: string) => Promise<{ height: number; width: number }>` | Root size of an SVG whose width/height are not plain pixels. |
