Skip to main content

Text

Typeobject
Backlinks5

Details of a text.

PropertyTypeRequired
idstringRequired
namestringOptional
isLockedbooleanRequired
visiblebooleanRequired
contextSettingsGraphicsContextSettingsRequired
styleStyleRequired
boundsRectRequired
transformedBoundsRectOptional
matrixMatrixRequired
alphaMaskByArray<AlphaMask>Required
outlineMaskByArray<string>Required
maskTypeintegerRequired
styleEffectMaskAreaintegerRequired
maskShowTypeintegerOptional
overflowintegerRequired
cornerSmoothingnumberOptional
overrideKeystringOptional
horizontalConstraintConstraintOptional
verticalConstraintConstraintOptional
resizesContentintegerOptional
keepShapeWhenResizebooleanOptional
variableDefsArray<VariableDef>Optional
variableRefsArray<VariableRef>Optional
styleEffectBooleanintegerOptional
classstringRequired
contentstringRequired
anchorPointPointOptional
textOnPathTextOnPathOptional
frameModeintegerRequired
truncatedHeightnumberOptional
verticalAlignmentintegerRequired
horizontalAlignmentArray<integer>Required
defaultFontAttrFontAttrOptional
fontAttrArray<FontAttr>Required
textLineTypeArray<TextLineType>Optional
verticalTrimbooleanOptional

id​

Required

Description

ID of the object, globally unique.

Type

string

name​

Optional

Description

Name of the object, for user identification, encoded in UTF-8.

Type

string

isLocked​

Required

Description

If true, the object will be unable to be edited.

Type

boolean

visible​

Required

Description

If false, the object will be invisible.

Type

boolean

contextSettings​

Required

Description

The opacity and blending-related configurations of the object.

style​

Required

Description

The borders, fills, and other styles of the object.

Type

Style

bounds​

Required

Description

The bounds of the object before undergoing matrix transformations.

Type

Rect

transformedBounds​

Optional

Description

An enclosing rectangle for the object. This property stores information about the object after the matrix transformation.

Type

Rect

matrix​

Required

Description

Matrix used for translating, rotating, and scaling the object.

Type

Matrix

alphaMaskBy​

Required

Description

A list of alpha masks applied to the object.

Type

Array<AlphaMask>

outlineMaskBy​

Required

Description

A list of outline masks applied to the object, clipped by the intersection of their outlines. The items in the list are object IDs of the masks.

Type

Array<string>

maskType​

Required

Description

The mask type of the object.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
0
not a mask
1
outline mask
2
alpha mask

styleEffectMaskArea​

Required

Description

How the style and visible of the mask object affect the area of the mask.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
0
The style and visible of the mask object do not affect the area of the mask, which depends on its bounds.
1
The style of the mask object does not affect the area of the mask, while the visible does.
2
The style and visible of the mask object do affect the area of the mask.

maskShowType​

Optional

Description

How the mask object is displayed.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
0
depend on its style. (Default value for outline mask.)
1
only display its bounds. (Default value for alpha mask when its alphaType equals 0.)
2
do not display. (Default value for other conditions.)

overflow​

Required

Description

How to display the child element of the object when it overflows its container.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
1
hidden. Anything outside the scope of the container will be cropped and invisible.
2
visible. Contents outside the scope of the container will not be cropped and will be visible.
3
scrolled. Content that is outside the container's scope is cropped, and a scrollbar is displayed to view the content that is beyond the container's boundaries.

cornerSmoothing​

Optional

Description

Smoothness of rounded corners. Range: [0, 1]. 0 is the default value, indicating no smoothing for rounded corners.

Type

number

overrideKey​

Optional

Description

Used to be associated with the object by symbol instances for overriding its attributes. Check the objectId in the OverrideValue for details. If overrideKey exists, find a symbol master through upward traversal (which could be the object itself); overrideKey is unique within the symbol master.

Type

string

horizontalConstraint​

Optional

Description

Horizontal constraints for the object. Default value is 1.

verticalConstraint​

Optional

Description

Vertical constraints for the object. Default value is 1.

resizesContent​

Optional

Description

How child objects behave when the object is resized.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
0
If the current object contains children (suitable for paths with boolean operations), the current object serves as the starting point. For each child, if the object chain includes a frame or symbol without a layout, the constraints on the child object are applied (ignoring constraints for groups and top-level paths with boolean operations). Otherwise, scaling is applied.
1
Force child objects to have fixed positions and sizes.
2
Apply child object constraints. (Default value.)

keepShapeWhenResize​

Optional

Description

False: When resizing occurs, the object scales according to the horizontalConstraint and verticalConstraint. (Default value.) True: When resizing occurs, the object itself maintains its angle, and the center position is scaled. The scaling occurs along both the length and width directions.

Type

boolean

variableDefs​

Optional

Description

A list of variables that can be used by children.

Type

Array<VariableDef>

variableRefs​

Optional

Description

A list of referenced variables.

Type

Array<VariableRef>

styleEffectBoolean​

Optional

Description

How the style of the object affects the region participating in a Boolean operation with another object.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
0
ignore style(default value): The region in which an object participates in a Boolean operation is independent of its style.
1
If the object is a path and the path has borders without fills, then the borders will be used as a region to participate in the Boolean operation calculation. If the object is a text and the text has borders without fills, then the object will be ignored during the Boolean operation. In other cases, it behaves the same as ignore style.

class​

Required

Type

string

Value

constant: the value of this property must be equal to:

"text"

content​

Required

Description

The text content of the text object. The encoding format is UTF-8.

Type

string

anchorPoint​

Optional

Description

The position of the first character baseline when text is drawn. Horizontal and vertical alignments have been considered. The given coordinates are in the object's own coordinate system. If this property doesn't exist, text is drawn using bounds.

Type

Point

textOnPath​

Optional

Description

The text is arranged along the path.

frameMode​

Required

Description

The mode of the text frame size.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
0
fixed. The size of the text frame is fixed.
1
auto width. The width and height of the text frame are both adaptive.
2
auto height. The height of the text frame is adaptive, and the width is fixed.

truncatedHeight​

Optional

Description

The maximum height that can be displayed inside the text frame, with any text exceeding this height being truncated.

Type

number

verticalAlignment​

Required

Description

The type of vertical alignment for the text.

Type

integer

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
0
top
1
center
2
bottom

horizontalAlignment​

Required

Description

The type of horizontal alignment for the text. When the number of items is less than the number of rows, the last value is reused.

Type

Array<integer>

Value

enum: the value of this property must be equal to one of the following values:

ValueExplanation
0
left
1
right
2
center
3
justified
4
natural
5
justified, and the last line to the left
6
justified, and the last line to the center
7
justified, and the last line to the right

defaultFontAttr​

Optional

Description

The default font attributes of the text. If some font attributes are missing in fontAttr, take the font attributes here. The value of length in this field is meaningless.

fontAttr​

Required

Description

An ordered list, where each item sequentially describes the font attributes of a text fragment. If some font attributes are missing in an item, take the font attributes from defaultFontAttr.

Type

Array<FontAttr>

textLineType​

Optional

Description

A list with a length equals to the number of text lines, where each item describes the index preceding each line of text.

Type

Array<TextLineType>

verticalTrim​

Optional

Description

If true, trim the text portion that extends beyond the text frame starting from the baseline, based on verticalAlignment Default value is false.

Type

boolean