Preparing search index...

    Class VectorTextBuilder

    A mutable builder for an immutable VectorText run. Start one with VectorTextBuilder.create, optionally refine with VectorTextBuilder#setWeight, VectorTextBuilder#setItalic, VectorTextBuilder#setLetterSpacing, and VectorTextBuilder#setHorizontalAlignment, then call VectorTextBuilder#build to produce the text run. The builder remains usable after build(). The font is the composite's font source (see VectorCompositeBuilder#setFontSource), not a per-run family.

    Lens Scripting Version 374

    var tb = VectorTextBuilder.create("Hello", 48);
    tb.setWeight(700);
    tb.setHorizontalAlignment(HorizontalAlignment.Center);
    var text = tb.build();

    Hierarchy (View Summary)

    Index

    Methods

    • Returns a new immutable VectorText that snapshots the current builder state. The builder remains usable afterward; the returned text run is an independent snapshot.

      Returns VectorText

      Lens Scripting Version 374

    • Creates a builder for a text run with the given text content and font size. Throws if size is not greater than 0, or if size is not finite.

      Parameters

      • text: string

        The text content (String).

      • size: number

        The font size (Number, must be > 0), in canvas pixels.

      Returns VectorTextBuilder

      Lens Scripting Version 374

    • Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

      Returns string

      Lens Scripting Version 374

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Sets the HorizontalAlignment — where this run sits relative to its baseline position. Defaults to Left (the SVG start default).

      Parameters

      Returns void

      Lens Scripting Version 374

    • Sets whether the run is italicized. Defaults to false.

      Parameters

      • italic: boolean

        Whether the run is italicized (Boolean).

      Returns void

      Lens Scripting Version 374

    • Sets additional spacing between characters, in canvas pixels. Must be finite. Defaults to 0. Throws if spacing is not finite.

      Parameters

      • spacing: number

        The letter spacing (Number, finite).

      Returns void

      Lens Scripting Version 374

    • Sets the font weight. Must be between 100 and 900, inclusive. Defaults to 400 (normal). Throws if weight is outside [100, 900].

      Parameters

      • weight: number

        The font weight (Number, must be in [100, 900]).

      Returns void

      Lens Scripting Version 374