MLightCAD
    Preparing search index...

    Font helpers for MTEXT and UI (character map, ribbon): wraps the shared FontManager cache, SHX parsing (ShxParserFont), and drawing font catalog (AcApDocManager).

    Keeps UI packages off direct @mlightcad/mtext-renderer imports while using the same global font pipeline as rendering.

    Index

    Constructors

    Methods

    • Parses a user-uploaded font file, registers it for rendering, and stores it in IndexedDB when font caching is enabled.

      Supported formats: .shx, .ttf, .otf, .woff.

      Parameters

      • data: File | ArrayBuffer

        Font file contents or a browser File selected by the user

      • OptionalfileName: string

        Font file name when data is an ArrayBuffer

      • Optionalaliases: string[]

        Optional alias names (e.g. missed drawing font names)

      • Optionalencoding: string

        Optional character encoding for SHX bigfonts

      Returns Promise<FontLoadStatus>

    • Declared font engine kind from the CAD font catalog only (before or after load).

      Parameters

      • fontName: string

      Returns "mesh" | "shx" | undefined

      Use when AcApFontUtil has not yet loaded the font: the catalog still knows shx vs mesh. After load, getFontType is authoritative.

    • Font name used at render time when the requested font is missing.

      Checks user FontManager.setFontMapping | font mapping first, then falls back to FontManager.defaultFonts.

      Parameters

      • fontName: string

        Original font name referenced by the drawing.

      Returns string

      The loaded font name if available; otherwise the mapped or default replacement.

    • Sorted SHX glyph indices present in the loaded font payload.

      Parameters

      • fontName: string

        Name as registered in the font manager after load.

      Returns number[]

      Code list, or empty when the font is missing or not SHX.