Loads the default faces and registers the oconvDefaultFaces descriptor on an @awacloud/fw ModuleRuntime.

Module registerDefaultFaces | Source packages/front/office/oconv-fonts/src/loader.js | Deps none | Worker-safe no — see Worker Usage in the frozen contract

This function is the composed load-then-register helper documented in full in ../descriptor.md — this page states its signature, params, return and throws only; it does not re-derive the per-style-class precedence rule, which lives solely in the frozen contract.

Resolve

import { registerDefaultFaces } from '@awacloud/oconv-fonts';

Signature

registerDefaultFaces(runtime: {register: Function}, opts?: { baseUrl?: string | URL }) => Promise<*>

Parameters

Param Type Description
runtime {register: Function} An @awacloud/fw ModuleRuntime.
opts {baseUrl?: string|URL} (optional) Forwarded to loadDefaultFaces.

Returns

Promise<*> — what runtime.register returns (the runtime, chainable): runtime.register(createOconvDefaultFaces(await loadDefaultFaces(opts))).

Throws

  • Error — any loadDefaultFaces error (`oconv-fonts: cannot load <url> (...)`); the descriptor is not registered when loading fails.

Examples

import { ModuleRuntime } from '@awacloud/fw/core/runtime.js';
import { registerDefaultFaces } from '@awacloud/oconv-fonts';

const runtime = new ModuleRuntime();
await registerDefaultFaces(runtime);          // fetches the 5 vendored faces the
                                               // default route uses and registers
                                               // the 'oconvDefaultFaces' descriptor

const api = runtime.resolve('oconvDefaultFaces');
// { defaultFaces, family: 'Liberation', release: '2.1.5' }

Registering twice does not hot-swap a cached instance by itself — see ../descriptor.md and the package README for the host rule (invalidate('oconvDefaultFaces', { cascade: true }) after re-registering).

See also

  • ../descriptor.md — the frozen oconvDefaultFaces contract: resolved API, frozen surface, the per-style-class precedence rule explicit opts.pdf.fonts[<class>] > default map[<class>] > Standard 14, the default map being a posted defaultFaces map (which wins whole) else the registered oconvDefaultFaces, and worked examples.
  • load-default-faces — the byte path this function calls before registering.
  • create-oconv-default-faces — the descriptor builder this function calls with the loaded bytes.
  • ./README.md — the API index.