Skip to main content

VectorText

Class

An immutable text run style — content, size, weight, italics, letter spacing, and horizontalAlignment.

  • Snapchat: not supported
  • SPECS: fully supported
  • Camera Kit Web: not supported
  • Camera Kit Mobile: not supported
  • SnapchatNot supported — Available on SPECS only
  • SPECSFully supported
  • Camera Kit WebNot supported — Available on SPECS only
  • Camera Kit MobileNot supported — Available on SPECS only

Platform details

  • Snapchat — Not supported — Available on SPECS only.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported — Available on SPECS only.

  • Camera Kit Mobile — Not supported — Available on SPECS only.

Since Lens Scripting v374

An immutable text run style — content, size, weight, italics, letter spacing, and horizontalAlignment. Produced by VectorTextBuilder#build and never mutated after. A text run carries only content and style (no color, no placement, no font — the font is the composite's font source), so it is freely shareable: pass the same VectorText to multiple text draw ops to reuse one style across several runs. Exposes read-only metadata — VectorText#text, VectorText#fontSize, and VectorText#horizontalAlignment.

Index

Example

var tb = VectorTextBuilder.create("Hello", 48);
tb.setHorizontalAlignment(HorizontalAlignment.Center);
var text = tb.build();
print(text.text); // "Hello"
print(text.fontSize); // 48

Extends

Properties

fontSize

readonly fontSize: number

SPECS

The font size, in canvas pixels. Always greater than 0.

Since

Lens Scripting Version 374


horizontalAlignment

readonly horizontalAlignment: HorizontalAlignment

SPECS

The HorizontalAlignment — where this run sits relative to its baseline position.

Since

Lens Scripting Version 374


text

readonly text: string

SPECS

The text content of this run.

Since

Lens Scripting Version 374

Methods

getTypeName()

static getTypeName(): TypeName<VectorText>

SPECS

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

TypeName<VectorText>

Since

Lens Scripting Version 374

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

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

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

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

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame