Skip to main content

CustomVariationStyle

Class

A user-defined named style on a variable Font.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

A user-defined named style on a variable Font. Holds the standard variation axis values (weight, width, slant, italic, opticalSize) plus any custom axes the font exposes (e.g. GRAD, YOPQ). Create via Font.createVariationStyle.

Index

Example

//@input Asset.Font fontAsset
//@input Component.Text text
var style = script.fontAsset.createVariationStyle("CustomStyle");
style.weight = 565;
style.GRAD = 14;
script.text.preferredStyle = style.name;

Extends

Indexable

[index: string]: any

Properties

italic

italic: boolean

Italic axis value (ital). If no ital axis is present, changes slant axis value (slnt) instead.

Since

Lens Scripting Version 372

Default Value

false

name

readonly name: string

Name of the custom variation style. Used to assign to Text.preferredStyle to change style to custom style.

Since

Lens Scripting Version 372


opticalSize

opticalSize: number

Optical size axis value (opsz).

Since

Lens Scripting Version 372

Default Value

48

slant

slant: number

Slant axis value (slnt), in degrees.

Since

Lens Scripting Version 372

Default Value

0

weight

weight: number

Weight axis value (wght).

Since

Lens Scripting Version 372

Default Value

400

width

width: number

Width axis value (wdth).

Since

Lens Scripting Version 372

Default Value

100

Methods

getTypeName()

static getTypeName(): TypeName<CustomVariationStyle>

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<CustomVariationStyle>

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