style
Text Style
Section titled “Text Style”text.sourceText.style
Most of these functions are accessible from the SourceText.style object in AE 17.0 and later. Where noted, additional methods were added in AE 25.0. The ability to control per-character styling was also added in 25.0. Use the second and third arguments (when available) to control per-character styling.
For more info on working with text styles, see:
- Use Expressions to Edit and Access Text Properties on helpx.adobe.com
- After Effects 2020: Express Yourself (and Your Text) on blog.adobe.com
- After Effects 2025: Per-Character Text Style Expressions on youtube.com
Chaining
Section titled “Chaining”All the methods for Text Style will return a Text Style object, so you can call them in a chain, e.g.:
text.sourceText.style.setFont("Times New Roman").setFontSize(42).setText("New Text");
Attributes
Section titled “Attributes”TextStyle.applyFill
Section titled “TextStyle.applyFill”text.sourceText.style.applyFill
Description
Section titled “Description”Returns whether Fill Color is enabled.
Boolean
TextStyle.applyStroke
Section titled “TextStyle.applyStroke”text.sourceText.style.applyStroke
Description
Section titled “Description”Returns whether Stroke is enabled.
Boolean
TextStyle.baselineDirection
Section titled “TextStyle.baselineDirection”text.sourceText.style.baselineDirection
Description
Section titled “Description”Returns the Baseline Direction for a Text layer.
Predefined string. One of:
"default"
"rotated"
"tate-chuu-yoko"
TextStyle.baselineOption
Section titled “TextStyle.baselineOption”text.sourceText.style.baselineOption
Description
Section titled “Description”Returns the Baseline Option Type for a Text layer.
Predefined string. One of:
"default"
"subscript"
"superscript"
TextStyle.baselineShift
Section titled “TextStyle.baselineShift”text.sourceText.style.baselineShift
Description
Section titled “Description”Returns the value of Baseline Shift for a Text layer.
Number
TextStyle.digitSet
Section titled “TextStyle.digitSet”text.sourceText.style.digitSet
Description
Section titled “Description”Returns the Digit Set for a Text layer.
Predefined string. One of:
"default"
"hindidigits"
TextStyle.direction
Section titled “TextStyle.direction”text.sourceText.style.direction
Description
Section titled “Description”Returns the value of Direction of the first paragraph of a Text layer.
Predefined string. One of:
"left-to-right"
"right-to-left"
TextStyle.fillColor
Section titled “TextStyle.fillColor”text.sourceText.style.fillColor
Description
Section titled “Description”Returns the text Fill Color as RGB values on a scale from 0 - 1.0.
Array of Numbers.
TextStyle.firstLineIndent
Section titled “TextStyle.firstLineIndent”text.sourceText.style.firstLineIndent
Description
Section titled “Description”Returns the value of First Line Indent of the first line of the first paragraph of a Text layer.
Number
TextStyle.font
Section titled “TextStyle.font”text.sourceText.style.font
Description
Section titled “Description”Returns the font name for a Text layer.
String
TextStyle.fontSize
Section titled “TextStyle.fontSize”text.sourceText.style.fontSize
Description
Section titled “Description”Returns the value of Font Size for a Text layer.
Number
TextStyle.horizontalScaling
Section titled “TextStyle.horizontalScaling”text.sourceText.style.horizontalScaling
Description
Section titled “Description”Returns the Horizontal Scaling for a Text layer.
Number
TextStyle.isAllCaps
Section titled “TextStyle.isAllCaps”text.sourceText.style.isAllCaps
Description
Section titled “Description”Returns whether All Caps is enabled.
Boolean
TextStyle.isAutoLeading
Section titled “TextStyle.isAutoLeading”text.sourceText.style.isAutoLeading
Description
Section titled “Description”Returns whether Auto Leading is enabled.
Boolean
TextStyle.isEveryLineComposer
Section titled “TextStyle.isEveryLineComposer”text.sourceText.style.isEveryLineComposer
Description
Section titled “Description”Returns true
if the Text layer if Every-Line Composer is set for the first paragraph of a Text layer and false
if Single-Line Composer is set for the first paragraph of a Text layer
Boolean
TextStyle.isFauxBold
Section titled “TextStyle.isFauxBold”text.sourceText.style.isFauxBold
Description
Section titled “Description”Returns whether Faux Bold is enabled.
Boolean
TextStyle.isFauxItalic
Section titled “TextStyle.isFauxItalic”text.sourceText.style.isFauxItalic
Description
Section titled “Description”Returns whether Faux Italics are enabled.
Boolean
TextStyle.isHangingRoman
Section titled “TextStyle.isHangingRoman”text.sourceText.style.isHangingRoman
Description
Section titled “Description”Whether Hanging Roman Punctuation is set for the entire Text layer.
Boolean
TextStyle.isLigature
Section titled “TextStyle.isLigature”text.sourceText.style.isLigature
Description
Section titled “Description”Returns whether ligatures are enabled.
Boolean
TextStyle.isSmallCaps
Section titled “TextStyle.isSmallCaps”text.sourceText.style.isSmallCaps
Description
Section titled “Description”Returns whether Small Caps is enabled.
Boolean
TextStyle.justification
Section titled “TextStyle.justification”text.sourceText.style.justification
Description
Section titled “Description”Returns the value of Justification of the first paragraph of a Text layer.
The left and right values for alignment/justification will be reversed if the Text layer’s TextStyle.direction is set to use right-to-left. You can control this using the Property or Paragraph panel, or via TextStyle.setDirection().
Predefined string. One of:
"alignCenter"
"alignLeft"
"alignRight"
"justifyFull"
"justifyLastCenter"
"justifyLastLeft"
"justifyLastRight"
TextStyle.kerning
Section titled “TextStyle.kerning”text.sourceText.style.kerning
Description
Section titled “Description”Returns the Kerning Value for a Text Layer.
For this value to be returned as anything other than zero, the KerningType must not be set.
Number. Read-only.
TextStyle.kerningType
Section titled “TextStyle.kerningType”text.sourceText.style.kerningType
Description
Section titled “Description”Returns the Kerning Type for a Text layer.
Read-only. Predefined string. One of:
"manual"
"metrics"
"optical"
TextStyle.leading
Section titled “TextStyle.leading”text.sourceText.style.leading
Description
Section titled “Description”Returns the value of Leading for a Text layer.
Number
TextStyle.leadingType
Section titled “TextStyle.leadingType”text.sourceText.style.leadingType
Description
Section titled “Description”Returns the value of Leading Type for the first paragraph of a Text layer.
Predefined string. One of:
"bottom-to-bottom"
"top-to-top"
TextStyle.leftMargin
Section titled “TextStyle.leftMargin”text.sourceText.style.leftMargin
Description
Section titled “Description”Returns the value of Left Margin of the first paragraph of a Text layer.
Number
TextStyle.lineJoin
Section titled “TextStyle.lineJoin”text.sourceText.style.lineJoin
Description
Section titled “Description”Returns the Line Join Type for a Text layer.
Predefined string. One of:
"bevel"
"miter"
"round"
TextStyle.rightMargin
Section titled “TextStyle.rightMargin”text.sourceText.style.rightMargin
Description
Section titled “Description”Returns the value of Right Margin of the first paragraph of a Text layer.
Number
TextStyle.spaceAfter
Section titled “TextStyle.spaceAfter”text.sourceText.style.spaceAfter
Description
Section titled “Description”Returns the value of the Space After the first paragraph of a Text layer.
Number
TextStyle.spaceBefore
Section titled “TextStyle.spaceBefore”text.sourceText.style.spaceBefore
Description
Section titled “Description”Returns the value of the Space Before the first paragraph of a Text layer.
Number
TextStyle.strokeColor
Section titled “TextStyle.strokeColor”text.sourceText.style.strokeColor
Description
Section titled “Description”Returns the Stroke Color as RGB values on a scale from 0 - 1.0.
Array of numbers
TextStyle.strokeWidth
Section titled “TextStyle.strokeWidth”text.sourceText.style.strokeWidth
Description
Section titled “Description”Returns the Stroke Width value for a Text layer.
Number
TextStyle.tracking
Section titled “TextStyle.tracking”text.sourceText.style.tracking
Description
Section titled “Description”Returns the value of Tracking for a Text layer.
Number
TextStyle.tsume
Section titled “TextStyle.tsume”text.sourceText.style.tsume
Description
Section titled “Description”Returns the Tsume value for a Text layer.
Number (between 0
and 1
).
TextStyle.verticalScaling
Section titled “TextStyle.verticalScaling”text.sourceText.style.verticalScaling
Description
Section titled “Description”Returns the Vertical Scaling for a Text layer.
Number
Methods
Section titled “Methods”TextStyle.replaceText()
Section titled “TextStyle.replaceText()”text.sourceText.style.replaceText(value[, startIndex, numOfCharacters])
Description
Section titled “Description”This is used when you want to define (or inherit) a Text Style, while setting the content for a substring of the text.
Parameters
Section titled “Parameters”Parameter | Type | Description | |
---|---|---|---|
value | String | Required. | The text to set. |
startIndex | Number | Optional. | The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. | The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”Example
Section titled “Example”To create a custom style and then set a substring of the text within the expression:
// assume the value of the source text is "Old Text"const referenceText = thisComp.layer("Source Layer Name").text.sourceText;const style = referenceText.getStyleAt(0,0);
// This will change the text from "Old Text" to "NewText" as the first 4 characters are replaced.style.replaceText("New", 0, 4);
TextStyle.setAllCaps()
Section titled “TextStyle.setAllCaps()”text.sourceText.style.setAllCaps(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the All Caps status.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Required. Whether to enable or disable All Caps. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setApplyFill()
Section titled “TextStyle.setApplyFill()”text.sourceText.style.setApplyFill(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set whether Fill Color is enabled.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Required. Whether to enable or disable Fill. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setApplyStroke()
Section titled “TextStyle.setApplyStroke()”text.sourceText.style.setApplyStroke(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set whether Stroke is enabled.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Required. Whether to enable or disable Stroke. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setAutoLeading()
Section titled “TextStyle.setAutoLeading()”text.sourceText.style.setAutoLeading(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Auto Leading status.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Required. Whether to enable or disable Auto Leading. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setBaselineDirection()
Section titled “TextStyle.setBaselineDirection()”text.sourceText.style.setBaselineDirection(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Baseline Direction.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Predefined string as defined in BaselineDirection | The value to set for Baseline Direction. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setBaselineShift()
Section titled “TextStyle.setBaselineShift()”text.sourceText.style.setBaselineShift(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Baseline Shift to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | Required. The Baseline Shift value to set. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setBaselineOption()
Section titled “TextStyle.setBaselineOption()”text.sourceText.style.setBaselineOption(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the baseline option.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Predefined string as defined in BaselineOption | Required. The value to set for Baseline Option. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setDigitSet()
Section titled “TextStyle.setDigitSet()”text.sourceText.style.setDigitSet(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Digit Set.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Predefined string as defined in DigitSet | Required. The value to use for Digit Set. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setDirection()
Section titled “TextStyle.setDirection()”text.sourceText.style.setDirection(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to set the Direction for the entire Text layer, either left-to-right
or right-to-left
.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Predefined string as defined in Direction | The desired value for Direction. |
Returns
Section titled “Returns”TextStyle.setEveryLineComposer()
Section titled “TextStyle.setEveryLineComposer()”text.sourceText.style.setEveryLineComposer(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to enable or disable the Every-Line Composer for the entire Text layer.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Whether to enable or disable Every-Line Composer. |
Returns
Section titled “Returns”TextStyle.setFauxBold()
Section titled “TextStyle.setFauxBold()”text.sourceText.style.setFauxBold(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Faux Bold status.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Required. Whether to enable or disable Faux Bold. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setFauxItalic()
Section titled “TextStyle.setFauxItalic()”text.sourceText.style.setFauxItalic(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Faux Italics status.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Required. Whether to enable or disable Faux Italics. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setFillColor()
Section titled “TextStyle.setFillColor()”text.sourceText.style.setFillColor(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the text Fill Color.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Keep in mind that TextStyle.applyFill must be true
in order for the fill color to show up. You can set it to true
by enabling Fill in the Properties or Character panel, or by using TextStyle.setApplyFill().
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Array of numbers | Required. [R, G, B] with each value between 0.0 and 1.0 . |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setFirstLineIndent()
Section titled “TextStyle.setFirstLineIndent()”text.sourceText.style.setFirstLineIndent(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to set the First Line Indent of a Text layer to a specified value.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | The desired value for First Line Indent. |
Returns
Section titled “Returns”TextStyle.setFont()
Section titled “TextStyle.setFont()”text.sourceText.style.setFont(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the font to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | String | Required. The font to set. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setFontSize()
Section titled “TextStyle.setFontSize()”text.sourceText.style.setFontSize(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Font Size to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | Required. The Font Size to set. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setHangingRoman()
Section titled “TextStyle.setHangingRoman()”text.sourceText.style.setHangingRoman(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to enable or disable Hanging Roman Punctuation for the entire Text layer.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Whether to enable or disable Roman Hanging Punctuation. |
Returns
Section titled “Returns”TextStyle.setHorizontalScaling()
Section titled “TextStyle.setHorizontalScaling()”text.sourceText.style.setHorizontalScaling(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Horizontal Scaling to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | Required. The value to set the Horizontal Scaling. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setJustification()
Section titled “TextStyle.setJustification()”text.sourceText.style.setJustification(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to set the Justification for the entire Text layer.
The left and right values for alignment/justification will be reversed if the Text layer’s TextStyle.direction is set to use right-to-left. You can control this using the Property or Paragraph panel, or via TextStyle.setDirection().
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Predefined string as defined in Justification | The desired value for the Justification. |
Returns
Section titled “Returns”TextStyle.setKerning()
Section titled “TextStyle.setKerning()”text.sourceText.style.setKerning(value, characterIndex)
Description
Section titled “Description”Used to set the Kerning Value at the specifed character index.
This will only affect the Text layer when KerningType is not set for the character index.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | Required. The value to set the Kerning Value. |
characterIndex | Number | Required. The character index for the substring to be applied. |
Returns
Section titled “Returns”None
TextStyle.setKerningType()
Section titled “TextStyle.setKerningType()”text.sourceText.style.setKerningType(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Kerning Type.
The value will be applied to the entire Text layer unless a start index and number of characters are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | metrics or optical , as defined in KerningType. | Required. The value to set for Kerning Type. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be changed. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”None
TextStyle.setLeading()
Section titled “TextStyle.setLeading()”text.sourceText.style.setLeading(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Leading to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Keep in mind that TextStyle.isAutoLeading must be false
in order for setLeading()
to have any visible affect. You can set Leading to a value other than Auto in the Properties or Character panel, or via TextStyle.setAutoLeading().
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | Required. The Leading value to set. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setLeadingType()
Section titled “TextStyle.setLeadingType()”text.sourceText.style.setLeadingType(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to set the Leading Type for the entire Text layer.
Parameters
Section titled “Parameters”Parameter | Type | Description | |
---|---|---|---|
value | Predefined string as defined in LeadingType | The desired value for Leading Type. |
Returns
Section titled “Returns”TextStyle.setLeftMargin()
Section titled “TextStyle.setLeftMargin()”text.sourceText.style.setLeftMargin(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to set the Left Margin of a Text layer to a specified value.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | The desired value for Left Margin. |
Returns
Section titled “Returns”TextStyle.setLigature()
Section titled “TextStyle.setLigature()”text.sourceText.style.setLigature(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to enable or disable ligatures.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Required. Whether to enable or disable ligatures. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setLineJoin()
Section titled “TextStyle.setLineJoin()”text.sourceText.style.setLineJoin(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Line Join Type to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Predefined string as defined in LineJoin | Required. The value to set for Line Join Type. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setRightMargin()
Section titled “TextStyle.setRightMargin()”text.sourceText.style.setRightMargin(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to set the Right Margin of a Text layer to a specified value.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | The desired value for Right Margin. |
Returns
Section titled “Returns”TextStyle.setSmallCaps()
Section titled “TextStyle.setSmallCaps()”text.sourceText.style.setSmallCaps(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Small Caps status.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Boolean | Required. Whether to enable or disable Small Caps. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setSpaceAfter()
Section titled “TextStyle.setSpaceAfter()”text.sourceText.style.setSpaceAfter(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to set the Space After attribute of a Text layer to a specified value.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | The desired value for the Space After attribute. |
Returns
Section titled “Returns”TextStyle.setSpaceBefore()
Section titled “TextStyle.setSpaceBefore()”text.sourceText.style.setSpaceBefore(value)
This method must be called after TextStyle.setText() if both are being used.
Description
Section titled “Description”Used to set the Space Before attribute of a Text layer to a specified value.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | The desired value for the Space Before attribute. |
Returns
Section titled “Returns”TextStyle.setStrokeColor()
Section titled “TextStyle.setStrokeColor()”text.sourceText.style.setStrokeColor(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Stroke Color.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Keep in mind that TextStyle.applyStroke must be true
and TextStyle.strokeWidth must be greater than zero in order for any stroke color to be shown. You can set these by enabling Stroke or increasing Stroke Width in the Properties or Character panel, or by using TextStyle.setApplyStroke() and TextStyle.setStrokeWidth(), respectively.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Array of numbers | Required. [R, G, B] with each value between 0.0 and 1.0 . |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setStrokeWidth()
Section titled “TextStyle.setStrokeWidth()”text.sourceText.style.setStrokeWidth(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Stroke Width to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Keep in mind that TextStyle.applyStroke must be true
in order to see any change in stroke width. You can set this either by enabling Stroke in the Properties or Character panel, or via TextStyle.setApplyStroke().
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | Required. The value to set the Stroke Width. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setText()
Section titled “TextStyle.setText()”text.sourceText.style.setText(value)
Description
Section titled “Description”This is used when you want to define (or inherit) a Text Style while setting the text content separately.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | String | The text to set. |
Returns
Section titled “Returns”Examples
Section titled “Examples”To inherit the style and content from another layer:
const referenceText = thisComp.layer("Source Layer Name").text.sourceText;
const style = referenceText.getStyleAt(0, 0);style.setText(referenceText);
To create a custom style and then set the text within the expression:
text.sourceText .createStyle() .setFontSize(300) .setFont("Impact") .setText("Hello world!");
TextStyle.setTracking()
Section titled “TextStyle.setTracking()”text.sourceText.style.setTracking(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Tracking to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | Required. The Tracking value to set. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”TextStyle.setTsume()
Section titled “TextStyle.setTsume()”text.sourceText.style.setTsume(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Tsume to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | Required. The value to set the Tsume, between 0 and 100 . |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |
Returns
Section titled “Returns”None
TextStyle.setVerticalScaling()
Section titled “TextStyle.setVerticalScaling()”text.sourceText.style.setVerticalScaling(value[, startIndex, numOfCharacters])
Description
Section titled “Description”Used to set the Vertical Scaling to a specified value.
The value will be set for the entire Text layer unless startIndex
and numOfCharacters
are specified.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Number | Required. The value to set the Vertical Scaling. |
startIndex | Number | Optional. The start index for the substring to be replaced. Defaults to 0 . |
numOfCharacters | Number | Optional. The length of the substring to be replaced. Defaults to the number of characters until end of the string. |