Implements

Constructors

  • Creates an instance of TextState. Instead of creating an instance in new mode, use create to create an instance.

    Parameters

    • Optionaloptions: Options

      Create a TextState instance with the specified options.

    Returns TextState

    let textState = await TextState.create();
    

Properties

options: Options

Methods

  • Destroy the TextState object.

    Returns Promise<void>

  • Get the angle between device space X-axis and text baseline. In radians.

    Returns Promise<number>

    Returns the angle between device space X-axis and text baseline.

  • Get the character space.

    Returns Promise<number>

    Returns the character space.

  • Get the font size of the text state.

    Returns Promise<number>

    Returns the font size of the text state.

  • Get the horizontal size in device units.

    Returns Promise<number>

    Returns the horizontal size in device units.

  • Get the vertical size in device units.

    Returns Promise<number>

    Returns the vertical size in device units.

  • Get the angle that text space Y-axis shears in device space. In radians.

    Returns Promise<number>

    Returns the angle that text space Y-axis shears in device space.

  • Get the text mode.

    Returns Promise<number>

    Returns the text mode.

  • Get the word space.

    Returns Promise<number>

    Returns the word space.

  • Check whether the text state is null.

    Returns Promise<boolean>

    Returns true if the text state is null, otherwise false.

  • Set the character space.

    Parameters

    • charSpace: number

      The character space value, used to set the character spacing in text.

    Returns Promise<void>

  • Set the font of the text state.

    Parameters

    Returns Promise<void>

    let doc = await app.getActiveDoc();
    let font = await doc.addStandardFont('Times-Bold');
    await textState.setFont(font);
  • Set the font size of the text state.

    Parameters

    • fontSize: number

      The font size in pixels.

    Returns Promise<void>

  • Set the text mode.

    Parameters

    • textMode: number

      The text mode value, used to set the text rendering mode.Like:

      • 0 Fill text.
      • 1 Stroke text.
      • 2 Fill, then stroke text.
      • 3 Neither fill nor stroke text(invisible).

    Returns Promise<void>

  • Set the word space.

    Parameters

    • wordSpace: number

      The word space value, used to set the word spacing in text.

    Returns Promise<void>

  • Create a TextState instance with the specified options.

    Parameters

    • Optionaloptions: Options

      Create a TextState instance with the specified options.

    Returns Promise<TextStateType>

    Returns a TextState instance.

    let textState = await TextState.create();