Web SDKv1.0.0

fonts.customFonts

Your own fonts: the same bag FontRegistry.registerCustomFont() takes. Your own fonts are never gated. customFonts (a URL you serve or bytes you hold) works under every license, and so do the fonts embedded in the documents you open. The license governs where _our_ fonts come from, not which fonts you use. A viewer's fonts are the ones customFonts names when it is created; there is no method to add one to a running viewer. FontRegistry is exported for loading fonts outside a viewer — fonts you register with one you construct yourself are not seen by any viewer.
CustomFont[]

Example

customFontsTypeScript
// Register a custom font from URL
fonts: {
  customFonts: [
    {
      id: 'my-serif',
      displayName: 'My Serif',
      ttfUrl: 'https://cdn.example.com/fonts/MySerif-Regular.ttf',
      category: 'serif',
    },
  ],
}

Options 6

idstringRequired
Unique font identifier.
displayNamestringRequired
Name shown in the font picker.
ttfUrlstring
URL to a TTF file (fetched on demand). The file must be at most 24 MB and served as font bytes (an HTML response is refused); serve it with CORS headers when it is on another origin.
ttfBytesUint8Array
Pre-loaded TTF bytes (skips the fetch). The only kind of custom font that works with download: false.
category'sans-serif' | 'serif' | 'monospace' | 'display'Default'sans-serif'
The kind of face, for matching a substitute.
cssFallbackstringDefaultthe display name, then sans-serif
CSS font-family stack for previews.

More in Fonts