SheetXL - v1.0.2
    Preparing search index...

    Interface IFontCollection

    The fonts text is measured with: one table per family, weight and style, shared by every workbook, the way a browser's document.fonts is shared by a page.

    Measuring never waits. getByName answers at once with the closest table available and a status that says whether a closer one is loading; whenReady waits for those loads, and IFontCollection.Events.onCollectionChange fires as each settles. A workbook reaches it through IWorkbook.getFonts().

    interface IFontCollection {
        isIFontCollection: true;
        addListeners(
            listeners: Callbacks<SOURCE, EVENTS>,
            options?: IListener.Options,
        ): Remove;
        findBestMatch(
            fontName: string,
            options?: FindBestMatchOptions,
        ): FontHandle | null;
        getByName(
            family: string,
            options?: IFontCollection.GetByNameOptions,
        ): Resolution;
        getFontList(): readonly FontHandle[];
        isLoading(): boolean;
        load(faces: readonly (string | FaceRequest)[]): Promise<void>;
        setFontList(fontList: string[] | IFontFace[] | null): void;
        whenReady(): Promise<void>;
    }

    Hierarchy (View Summary)

    Index
    isIFontCollection: true

    For runtime type checking.

    • The offered family that matches fontName, else the first of options.fallbacks that does (a CSS generic name matches a family of its class), else null.

      Parameters

      Returns FontHandle | null

    • The table to measure a face with, now.

      Parameters

      Returns Resolution

      Never waits and never fails. A face with no table yet starts loading and is answered with the closest table available, its status 'loading'. The answer is cached until the collection changes, so asking again is cheap.

    • The families offered for choosing, as a font picker lists them.

      Returns readonly FontHandle[]

    • Whether a face is loading.

      Returns boolean

    • Starts loading these faces ahead of their first use.

      Parameters

      Returns Promise<void>

      Resolves when each has settled, with a table or without one.

    • Replaces the families offered for choosing; null restores the default list.

      Parameters

      Returns void

    • Resolves when no face is loading, including loads started while it waited.

      Returns Promise<void>