Skip to content
Document Authoring DA  API Docs v1.9.1
npmGitHub

FontIndex>= v1.0.26

FontIndex:

{
type: "index";
loadFn: (name: string) => BlobInput;
}

A FontIndex is the preferred way to add additional fonts to the system.

Document Authoring can efficiently load a single index of available fonts, and will then only load the actually required fonts as they are needed by calling loadFn with the font name. loadFn must return a BlobInput for the font file requested.

In order to generate a font index from a set of fonts you want to provide to your users, use the Document Authoring CLI utility:

Terminal window
npx document-authoring create-font-index --scan-directory path-to-fonts --write-to font-index.json

This will generate a font-index.json file that you can then host and load using the FontIndex configuration.

{
type: 'index',
index: fetch('/fonts/font-index.json'),
loadFn: (name) => fetch(`/fonts/${name}`),
}

FontConfig for configuring fonts, including using FontIndex.

type: "index"


index: BlobInput


loadFn: (name) => BlobInput

string

BlobInput