WebCAD-Lib-TS API 文档 - v1.0.0
    Preparing search index...

    Class MTextParser

    Main parser class for MText content

    Index

    Constructors

    • Creates a new MTextParser instance

      Parameters

      • content: string

        The MText content to parse

      • Optionalctx: MTextContext

        Optional initial MText context

      • options: MTextParserOptions = {}

        Parser options

      Returns MTextParser

    Methods

    • Decode multi-byte character from hex code

      Parameters

      • hex: string

        Hex code string (e.g. "C4E3")

      Returns string

      Decoded character or empty square if invalid

    • Push current context onto the stack

      Returns void

    • Pop context from the stack

      Returns void

    • Parse stacking expression (numerator/denominator)

      Returns [TokenTypeValue, [string, string, string]]

      Tuple of [TokenType.STACK, [numerator, denominator, type]]

    • Parse MText properties

      Parameters

      • cmd: string

        The property command to parse

      Returns { command: string; changes: Record<string, any>; depth: number }

      Property changes if yieldPropertyCommands is true and changes occurred

    • Get property changes between two contexts

      Parameters

      Returns Record<string, any>

      Object containing changed properties

    • Parse alignment property

      Parameters

      Returns void

    • Parse height property

      Parameters

      Returns void

    • Parse width property

      Parameters

      Returns void

    • Parse character tracking property

      Parameters

      Returns void

    • Parse float value or factor

      Parameters

      • value: number

        Current value to apply factor to

      Returns number

      New value

    • Parse oblique angle property

      Parameters

      Returns void

    • Parse ACI color property

      Parameters

      Returns void

    • Parse RGB color property

      Parameters

      Returns void

    • Extract float expression from scanner

      Parameters

      • relative: boolean = false

        Whether to allow relative values (ending in 'x')

      Returns string

      Extracted expression

    • Extract integer expression from scanner

      Returns string

      Extracted expression

    • Extract expression until semicolon or end

      Parameters

      • escape: boolean = false

        Whether to handle escaped semicolons

      Returns string

      Extracted expression

    • Consume optional terminator (semicolon)

      Returns void

    • Parse font properties

      Parameters

      Returns void

    • Parse paragraph properties from the MText content Handles properties like indentation, alignment, and tab stops

      Parameters

      Returns void

    • Parse MText content into tokens

      Returns Generator<MTextToken, void, unknown>

      MTextToken objects