VectorText
ClassAn 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
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
Properties
Methods
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
readonlyfontSize:number
SPECS
The font size, in canvas pixels. Always greater than 0.
Since
Lens Scripting Version 374
horizontalAlignment
readonlyhorizontalAlignment:HorizontalAlignment
SPECS
The HorizontalAlignment — where this run sits relative to its baseline position.
Since
Lens Scripting Version 374
text
readonlytext:string
SPECS
The text content of this run.
Since
Lens Scripting Version 374
Methods
getTypeName()
staticgetTypeName():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
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
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
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean