@rendley/sdk - v1.15.19
    Preparing search index...

    Class FontRegistry

    Manages custom fonts loaded into the document and tracks the metadata needed to serialize them.

    Index

    Constructors

    Properties

    fonts: IFontFaceDescriptor[]

    Methods

    • Removes all registered fonts from the document and clears the registry.

      Returns void

      Nothing.

    • Loads fonts restored from serialized data. The engine calls this during initialization.

      Fonts that are already registered (e.g. loaded by the host) are skipped, so calling this after deserialization never double-loads a font.

      Returns Promise<void>

      A promise that resolves after all pending fonts have been attempted.

    • Checks whether a font is already registered.

      Parameters

      • family: string

        Font family name to look up.

      • Optionalweight: string

        Optional font weight; when omitted any weight matches.

      • Optionalstyle: string

        Optional font style; when omitted any style matches.

      Returns boolean

      true if a matching font is registered; otherwise false.

    • Loads all @font-face rules found in a CSS file.

      Parameters

      • name: string

        Font family name to register for the discovered faces.

      • cssUrl: string

        URL of the stylesheet containing @font-face declarations.

      • OptionalcustomData: Map<string, unknown>

        Optional metadata stored alongside each registered font.

      Returns Promise<void>

      A promise that resolves after all matching font faces have been loaded.

    • Loads a font directly from a font file URL.

      Parameters

      • name: string

        Font family name to register.

      • url: string

        URL of the font file.

      • Optionaldescriptors: FontFaceDescriptors

        Optional FontFace descriptors such as weight or style.

      • OptionalcustomData: Map<string, unknown>

        Optional metadata stored alongside the registered font.

      Returns Promise<void>

      A promise that resolves after the font has been loaded and added to document.fonts.

    • Removes a registered font family from the document and registry.

      Parameters

      • fontFamily: string

        Font family name to remove.

      Returns void

      Nothing.

    • Preloads registered fonts for PIXI HTMLText rendering.

      Returns Promise<void>

      A promise that resolves after each registered font has been requested through PIXI.HTMLText.

    • Serializes the registered fonts and their metadata.

      Returns {
          fonts: {
              customData?: [string, unknown][];
              descriptors?: { style?: string; weight?: string };
              family: string;
              src: string;
          }[];
      }

      The serialized font registry payload.

    • Stores serialized font data to be loaded on the next init() call.

      Parameters

      • Optionaldata: unknown

        Serialized font registry payload to validate, or undefined to clear pending fonts.

      Returns void

      Nothing.

    • Restores a font registry from serialized data.

      Parameters

      • data: unknown

        Serialized font registry payload to validate and load.

      Returns Promise<FontRegistry>

      A promise that resolves to the deserialized font registry.