Font
ClassA font asset used for rendering text.
- Available on all platforms
Index
Properties
Methods
Example
// Assign a Font to a Label
//@input Component.Label label
//@input Asset.Font font
script.label.fontAsset = script.font;
Extends
Properties
customVariationStyles
customVariationStyles:
CustomVariationStyle[]
User-defined variation styles. See CustomVariationStyle. Populated via Font.createVariationStyle. Not applicable to static fonts.
Since
Lens Scripting Version 372
Default Value
[]
isVariableFont
readonlyisVariableFont:boolean
Returns true if this font is a variable font.
Since
Lens Scripting Version 372
name
name:
string
The name of the Asset in Lens Studio.
Default Value
""
Inherited from
namedInstances
readonlynamedInstances:NamedInstanceInfo[]
Named instance info for this font. Empty for static fonts. See NamedInstanceInfo.
Since
Lens Scripting Version 372
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
variationAxes
readonlyvariationAxes:VariationAxisInfo[]
Variation axes of this font. Empty for static fonts. See VariationAxisInfo.
Since
Lens Scripting Version 372
Methods
createVariationStyle()
createVariationStyle(
name):CustomVariationStyle
Create a new CustomVariationStyle bound to this font, append it to Font.customVariationStyles, and return it. Throws if called on a static font.
name must be non-empty and must not collide (case-, whitespace-, and
hyphen-insensitive) with a FontStyles constant (e.g. FontStyles.Bold),
a named instance on this font, or an existing custom variation style. Returns
null when the name is invalid.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
Since
Lens Scripting Version 372
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;
getTypeName()
staticgetTypeName():TypeName<Font>
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<Font>
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