MLightCAD
    Preparing search index...

    Represents a SHX font and provides methods to parse and render its characters. This class handles the loading and parsing of SHX font files, and provides methods to extract character shapes for rendering.

    Index

    Constructors

    • Creates a new ShxFont instance.

      Parameters

      • data: ArrayBuffer | ShxFontData

        Either raw binary data of the SHX font file (ArrayBuffer) or pre-parsed font data (ShxFontData)

      Returns ShxParserFont

      If the font data is invalid or cannot be parsed

    Properties

    fontData: ShxFontData

    The parsed font data containing header and content information

    Methods

    • Gets the shape data for a specific character at a given font size.

      Parameters

      • code: number

        The character code to get the shape for

      • size: number

        The desired font size

      Returns ShxShape | undefined

      The shape data for the character, or undefined if the character is not found in the font

    • Gets the shape data for a named shape at a given font size. Shape names are matched case-insensitively.

      Parameters

      • name: string

        The shape name to get the shape for

      • size: number

        The desired font size

      Returns ShxShape | undefined

      The shape data for the named shape, or undefined if it is not found in the font

    • Gets the character code for a named shape.

      Parameters

      • name: string

        The shape name to look up

      Returns number | undefined

      The character code, or undefined if the shape is not found

    • Gets the shape name for a character code, if one is defined.

      Parameters

      • code: number

        The character code to look up

      Returns string | undefined

      The shape name, or undefined if the code has no name

    • Return true if this font contains glyph of the specified character. Otherwise, return false.

      Parameters

      • code: number

      Returns boolean

      True if this font contains glyph of the specified character. Otherwise, return false.

    • Return true if this font contains a shape with the specified name. Otherwise, return false. Shape names are matched case-insensitively.

      Parameters

      • name: string

        The shape name to check (for example, "GRS")

      Returns boolean

      True if this font contains the named shape. Otherwise, return false.

    • Releases resources used by the font. This should be called when the font is no longer needed to free up memory.

      Returns void