textdocument
TextDocument object
Section titled “TextDocument object”new TextDocument(docText)
app.project.item(index).layer(index).property("Source Text").value
Description
Section titled “Description”The TextDocument object stores a value for a TextLayer’s Source Text property. Create it with the constructor, passing the string to be encapsulated.
Examples
Section titled “Examples”This sets a value of some source text and displays an alert showing the new value.
var myTextDocument = new TextDocument("HappyCake");myTextLayer.property("Source Text").setValue(myTextDocument);alert(myTextLayer.property("Source Text").value);
This sets keyframe values for text that show different words over time
var textProp = myTextLayer.property("Source Text");textProp.setValueAtTime(0, newTextDocument("Happy"));textProp.setValueAtTime(.33, newTextDocument("cake"));textProp.setValueAtTime(.66, newTextDocument("is"));textProp.setValueAtTime(1, newTextDocument("yummy!"));
This sets various character and paragraph settings for some text
var textProp = myTextLayer.property("Source Text");var textDocument = textProp.value;myString = "Happy holidays!";textDocument.resetCharStyle();textDocument.fontSize = 60;textDocument.fillColor = [1, 0, 0];textDocument.strokeColor = [0, 1, 0];textDocument.strokeWidth = 2;textDocument.font = "Times New Roman PSMT";textDocument.strokeOverFill = true;textDocument.applyStroke = true;textDocument.applyFill = true;textDocument.text = myString;textDocument.justification = ParagraphJustification.CENTER_JUSTIFY;textDocument.tracking = 50;textProp.setValue(textDocument);
Attributes
Section titled “Attributes”TextDocument.allCaps
Section titled “TextDocument.allCaps”textDocument.allCaps
Description
Section titled “Description”true
if a Text layer has All Caps enabled; otherwise false
. To set this value, use fontCapsOption added in After Effects 24.0.
This value only reflects the first character in the Text layer.
Boolean; read-only.
TextDocument.applyFill
Section titled “TextDocument.applyFill”textDocument.applyFill
Description
Section titled “Description”When true
, the Text layer shows a fill. Access the fillColor attribute for the actual color. When false
, only a stroke is shown.
Boolean; read/write.
TextDocument.applyStroke
Section titled “TextDocument.applyStroke”textDocument.applyStroke
Description
Section titled “Description”When true
, the Text layer shows a stroke. Access the strokeColor attribute for the actual color and strokeWidth for its thickness. When false
, only a fill is shown.
Boolean; read/write.
TextDocument.autoHyphenate
Section titled “TextDocument.autoHyphenate”textDocument.autoHyphenate
Description
Section titled “Description”The Text layer’s auto hyphenate paragraph option.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
Boolean; read/write.
TextDocument.autoLeading
Section titled “TextDocument.autoLeading”textDocument.autoLeading
Description
Section titled “Description”The Text layer’s auto leading character option.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
Boolean; read/write.
TextDocument.autoKernType
Section titled “TextDocument.autoKernType”textDocument.autoKernType
Description
Section titled “Description”The Text layer’s auto kern type option.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
An AutoKernType
enumerated value; read/write. One of:
AutoKernType.NO_AUTO_KERN
AutoKernType.METRIC_KERN
AutoKernType.OPTICAL_KERN
TextDocument.baselineDirection
Section titled “TextDocument.baselineDirection”textDocument.baselineDirection
Description
Section titled “Description”The Text layer’s baseline direction option. This is significant for Japanese language in vertical texts. “BASELINE_VERTICAL_CROSS_STREAM” is also know as Tate-Chu-Yoko.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
A BaselineDirection
enumerated value; read/write. One of:
BaselineDirection.BASELINE_WITH_STREAM
BaselineDirection.BASELINE_VERTICAL_ROTATED
BaselineDirection.BASELINE_VERTICAL_CROSS_STREAM
TextDocument.baselineLocs
Section titled “TextDocument.baselineLocs”textDocument.baselineLocs
Description
Section titled “Description”The baseline (x,y) locations for a Text layer. Line wraps in a paragraph text box are treated as multiple lines.
Array of floating-point values in the form of
[ line0.start_x, line0.start_y, line0.end_x, line0.end_y, line1.start_x, line1.start_y, line1.end_x, line1.end_y, ... lineN-1.start_x, lineN-1.start_y, lineN-1.end_x, lineN-1.end_y]
TextDocument.baselineShift
Section titled “TextDocument.baselineShift”textDocument.baselineShift
Description
Section titled “Description”This Text layer’s baseline shift in pixels.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Floating-point value; read-write.
TextDocument.boxAutoFitPolicy
Section titled “TextDocument.boxAutoFitPolicy”textDocument.boxAutoFitPolicy
Description
Section titled “Description”Enables the automated change of the box height to fit the text content in the box. The box only grows down.
Defaults to BoxAutoFitPolicy.NONE
.
Will be disabled if TextDocument.boxVerticalAlignment is anything other than BoxVerticalAlignment.TOP
.
A BoxAutoFitPolicy
enumerated value; read-write. One of:
BoxAutoFitPolicy.NONE
BoxAutoFitPolicy.HEIGHT_CURSOR
BoxAutoFitPolicy.HEIGHT_PRECISE_BOUNDS
BoxAutoFitPolicy.HEIGHT_BASELINE
TextDocument.boxFirstBaselineAlignment
Section titled “TextDocument.boxFirstBaselineAlignment”textDocument.boxFirstBaselineAlignment
Description
Section titled “Description”Controls the position of the first line of composed text relative to the top of the box.
Disabled if TextDocument.boxFirstBaselineAlignmentMinimum is anything other than zero.
Defaults to BoxFirstBaselineAlignment.ASCENT
.
A BoxFirstBaselineAlignment
enumerated value; read-write. One of:
BoxFirstBaselineAlignment.ASCENT
BoxFirstBaselineAlignment.CAP_HEIGHT
BoxFirstBaselineAlignment.EM_BOX
BoxFirstBaselineAlignment.LEADING
BoxFirstBaselineAlignment.LEGACY_METRIC
BoxFirstBaselineAlignment.MINIMUM_VALUE_ASIAN
BoxFirstBaselineAlignment.MINIMUM_VALUE_ROMAN
BoxFirstBaselineAlignment.TYPO_ASCENT
BoxFirstBaselineAlignment.X_HEIGHT
TextDocument.boxFirstBaselineAlignmentMinimum
Section titled “TextDocument.boxFirstBaselineAlignmentMinimum”textDocument.boxFirstBaselineAlignmentMinimum
Description
Section titled “Description”Manually controls the position of the first line of composed text relative to the top of the box.
A value set here other than zero will override the effect of the TextDocument.boxFirstBaselineAlignment value.
Defaults to zero.
Floating-point value; read/write.
TextDocument.boxInsetSpacing
Section titled “TextDocument.boxInsetSpacing”textDocument.boxInsetSpacing
Description
Section titled “Description”Controls the inner space between the box bounds and where the composable text box begins. The same value is applied to all four sides of the box.
Defaults to zero.
Floating-point value; read/write.
TextDocument.boxOverflow
Section titled “TextDocument.boxOverflow”textDocument.boxOverflow
Description
Section titled “Description”Returns true
if some part of the text did not compose into the box.
Boolean; read-only.
TextDocument.boxText
Section titled “TextDocument.boxText”textDocument.boxText
Description
Section titled “Description”true
if a Text layer is a layer of paragraph (bounded) text; otherwise false
.
Boolean; read-only.
TextDocument.boxTextPos
Section titled “TextDocument.boxTextPos”textDocument.boxTextPos
Description
Section titled “Description”The layer coordinates from a paragraph (box) Text layer’s anchor point as a [width, height] array of pixel dimensions.
Throws an exception if boxText does not return true
for the Text layer.
Array of ([X,Y]) position coordinates; read/write.
Example
Section titled “Example”// For a paragraph Text layer returns [x, y] position from layer anchor point in layer coordinates.// e.g. approximately [0, -25] with default character panel settings.var boxTextLayerPos = myTextLayer.sourceText.value.boxTextPos;
TextDocument.boxTextSize
Section titled “TextDocument.boxTextSize”textDocument.boxTextSize
Description
Section titled “Description”The size of a paragraph (box) Text layer as a [width, height] array of pixel dimensions.
Throws an exception if boxText does not return true
for the Text layer.
Array of two integers (minimum value of 1); read/write.
TextDocument.boxVerticalAlignment
Section titled “TextDocument.boxVerticalAlignment”textDocument.boxVerticalAlignment
Description
Section titled “Description”Enables the automated vertical alignment of the composed text in the box.
Defaults to BoxVerticalAlignment.TOP
A BoxVerticalAlignment
enumerated value; read-write. One of:
BoxVerticalAlignment.TOP
BoxVerticalAlignment.CENTER
BoxVerticalAlignment.BOTTOM
BoxVerticalAlignment.JUSTIFY
TextDocument.composedLineCount
Section titled “TextDocument.composedLineCount”textDocument.composedLineCount
Description
Section titled “Description”Returns the number of composed lines in the Text layer, may be zero if all text is overset.
The TextDocument object instance is initialized from the composed state and subsequent changes to the TextDocument object instance does not cause recomposition.
Even if you remove all the text from the TextDocument object instance, the value returned here remains unchanged.
Integer; read-only.
TextDocument.composerEngine
Section titled “TextDocument.composerEngine”textDocument.composerEngine
Description
Section titled “Description”The Text layer’s paragraph composer engine option. By default new Text layers will use the ComposerEngine.UNIVERSAL_TYPE_ENGINE
; the other enum value will only be encountered in projects created before the Universal Type Engine engine (formerly known as the South Asian and Middle Eastern engine) became the default in After Effects 22.1.1.
If this attribute has a mixed value, it will be read as undefined
.
This attrribute is read-write, but an exception will be thrown if any enum value other than ComposerEngine.UNIVERSAL_TYPE_ENGINE
is written.
In effect, you can change an older document from ComposerEngine.LATIN_CJK_ENGINE
to ComposerEngine.UNIVERSAL_TYPE_ENGINE
, but not the reverse.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
A ComposerEngine
enumerated value; read-write. One of:
ComposerEngine.LATIN_CJK_ENGINE
ComposerEngine.UNIVERSAL_TYPE_ENGINE
TextDocument.digitSet
Section titled “TextDocument.digitSet”textDocument.digitSet
Description
Section titled “Description”The Text layer’s digit set option.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
A DigitSet
enumerated value; read/write. One of:
DigitSet.DEFAULT_DIGITS
DigitSet.ARABIC_DIGITS
DigitSet.HINDI_DIGITS
DigitSet.FARSI_DIGITS
DigitSet.ARABIC_DIGITS_RTL
TextDocument.direction
Section titled “TextDocument.direction”textDocument.direction
Description
Section titled “Description”The Text layer’s paragraph direction option.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
A ParagraphDirection
enumerated value; read/write. One of:
ParagraphDirection.DIRECTION_LEFT_TO_RIGHT
ParagraphDirection.DIRECTION_RIGHT_TO_LEFT
TextDocument.endIndent
Section titled “TextDocument.endIndent”textDocument.endIndent
Description
Section titled “Description”The Text layer’s paragraph end indent option.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
Floating-point value; read/write.
TextDocument.everyLineComposer
Section titled “TextDocument.everyLineComposer”textDocument.everyLineComposer
Description
Section titled “Description”The Text layer’s Every-Line Composer paragraph option. If set to false
, the TextDocument will use the Single-Line Composer.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
Boolean; read/write.
TextDocument.fauxBold
Section titled “TextDocument.fauxBold”textDocument.fauxBold
Description
Section titled “Description”true
if a Text layer has faux bold enabled; otherwise false
.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Boolean; read/write.
Example
Section titled “Example”var isFauxBold = myTextLayer.sourceText.value.fauxBold;
TextDocument.fauxItalic
Section titled “TextDocument.fauxItalic”textDocument.fauxItalic
Description
Section titled “Description”true
if a Text layer has faux italic enabled; otherwise false
.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Boolean; read/write.
TextDocument.fillColor
Section titled “TextDocument.fillColor”textDocument.fillColor
Description
Section titled “Description”The Text layer’s fill color, as an array of [r, g, b]
floating-point values. For example, in an 8-bpc project, a red value of 255 would be 1.0, and in a 32-bpc project, an overbright blue value can be something like 3.2.
Throws an exception on read if applyFill is not true
.
Setting this value will also set applyFill to true
across the affected characters.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Array [r, g, b]
of floating-point values; read/write.
TextDocument.firstLineIndent
Section titled “TextDocument.firstLineIndent”textDocument.firstLineIndent
Description
Section titled “Description”The Text layer’s paragraph first line indent option.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
Floating-point value; read/write.
TextDocument.font
Section titled “TextDocument.font”textDocument.font
Description
Section titled “Description”The Text layer’s font specified by its PostScript name.
On write, there are very few resrictions on what can be supplied - if the underlying font management system does not have a matching Font object instance matching the supplied PostScript name a substitute instance will be created. The Font instance returned in the case of duplicate PostScript names will be the 0th element of the array returned from FontsObject.getFontsByPostScriptName().
You should use the Font object attribute for precise control.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
String; read/write.
TextDocument.fontBaselineOption
Section titled “TextDocument.fontBaselineOption”textDocument.fontBaselineOption
Description
Section titled “Description”The Text layer’s font baseline option. This is for setting a textDocument to superscript or subscript.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
A FontBaselineOption
enumerated value; read/write. One of:
FontBaselineOption.FONT_NORMAL_BASELINE
FontBaselineOption.FONT_FAUXED_SUPERSCRIPT
FontBaselineOption.FONT_FAUXED_SUBSCRIPT
TextDocument.fontCapsOption
Section titled “TextDocument.fontCapsOption”textDocument.fontCapsOption
Description
Section titled “Description”The Text layer’s font caps option.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
A FontCapsOption
enumerated value; read/write. One of:
FontCapsOption.FONT_NORMAL_CAPS
FontCapsOption.FONT_SMALL_CAPS
FontCapsOption.FONT_ALL_CAPS
FontCapsOption.FONT_ALL_SMALL_CAPS
TextDocument.fontFamily
Section titled “TextDocument.fontFamily”textDocument.fontFamily
Description
Section titled “Description”String with with the name of the font family.
This value only reflects the first character in the Text layer.
String; read-only.
TextDocument.fontLocation
Section titled “TextDocument.fontLocation”textDocument.fontLocation
Description
Section titled “Description”Path of font file, providing its location on disk.
Not guaranteed to be returned for all font types; return value may be empty string for some kinds of fonts.
This value only reflects the first character in the Text layer.
String; read-only.
TextDocument.fontObject
Section titled “TextDocument.fontObject”textDocument.fontObject
Description
Section titled “Description”The Text layer’s Font object specified by its PostScript name.
This value only reflects the first character in the Text layer.
Font object; read/write.
TextDocument.fontSize
Section titled “TextDocument.fontSize”textDocument.fontSize
Description
Section titled “Description”The Text layer’s font size in pixels.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Floating-point value (0.1 to 1296, inclusive); read/write.
TextDocument.fontStyle
Section titled “TextDocument.fontStyle”textDocument.fontStyle
Description
Section titled “Description”String with style information, e.g., “bold”, “italic”
This value only reflects the first character in the Text layer.
String; read-only.
TextDocument.hangingRoman
Section titled “TextDocument.hangingRoman”textDocument.hangingRoman
Description
Section titled “Description”The Text layer’s Roman Hanging Punctuation paragraph option. This is only meaningful to box Text layers—it allows punctuation to fit outside the box rather than flow to the next line.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
Boolean; read/write.
TextDocument.horizontalScale
Section titled “TextDocument.horizontalScale”textDocument.horizontalScale
Description
Section titled “Description”This Text layer’s horizontal scale in pixels.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Floating-point value; read-write.
Example
Section titled “Example”var valOfHScale = myTextLayer.sourceText.value.horizontalScale;
TextDocument.justification
Section titled “TextDocument.justification”textDocument.justification
Description
Section titled “Description”The paragraph justification for the Text layer.
A ParagraphJustification
enumerated value; read/write. One of:
ParagraphJustification.LEFT_JUSTIFY
ParagraphJustification.RIGHT_JUSTIFY
ParagraphJustification.CENTER_JUSTIFY
ParagraphJustification.FULL_JUSTIFY_LASTLINE_LEFT
ParagraphJustification.FULL_JUSTIFY_LASTLINE_RIGHT
ParagraphJustification.FULL_JUSTIFY_LASTLINE_CENTER
ParagraphJustification.FULL_JUSTIFY_LASTLINE_FULL
ParagraphJustification.MULTIPLE_JUSTIFICATIONS
Text layers with mixed justification values will be read as ParagraphJustification.MULTIPLE_JUSTIFICATIONS
.
Setting a TextDocument to use ParagraphJustification.MULTIPLE_JUSTIFICATIONS
will result in ParagraphJustification.CENTER_JUSTIFY
instead.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
TextDocument.kerning
Section titled “TextDocument.kerning”textDocument.kerning
Description
Section titled “Description”The Text layer’s kerning option.
Returns zero for AutoKernType.METRIC_KERN
and AutoKernType.OPTICAL_KERN
.
Setting this value will also set AutoKernType.NO_AUTO_KERN
to true
across the affected characters.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Integer value; read/write.
TextDocument.leading
Section titled “TextDocument.leading”textDocument.leading
Description
Section titled “Description”The Text layer’s spacing between lines.
Returns zero if TextDocument.autoLeading is true
.
Setting this value will also set TextDocument.autoLeading to true
across the affected characters.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
The minimum accepted value to set is 0, but this will be silently clipped to 0.01.
Floating-point value; read/write.
Example
Section titled “Example”// This creates a Text layer and sets the leading to 100
var composition = app.project.activeItem;var myTextLayer = comp.layers.addText("Spring\nSummer\nAutumn\nWinter");var myTextSource = myTextLayer.sourceText;var myTextDocument = myTextSource.value;myTextDocument.leading = 100;myTextSource.setValue(myTextDocument);
TextDocument.leadingType
Section titled “TextDocument.leadingType”textDocument.leadingType
Description
Section titled “Description”The Text layer’s paragraph leading type option.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
A LeadingType
enumerated value; read/write. One of:
LeadingType.ROMAN_LEADING_TYPE
LeadingType.JAPANESE_LEADING_TYPE
TextDocument.ligature
Section titled “TextDocument.ligature”textDocument.ligature
Description
Section titled “Description”The Text layer’s ligature option.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Boolean; read/write.
TextDocument.lineJoinType
Section titled “TextDocument.lineJoinType”textDocument.lineJoinType
Description
Section titled “Description”The Text layer’s line join type option for Stroke.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
A LineJoinType
enumerated value; read/write. One of:
LineJoinType.LINE_JOIN_MITER
LineJoinType.LINE_JOIN_ROUND
LineJoinType.LINE_JOIN_BEVEL
TextDocument.lineOrientation
Section titled “TextDocument.lineOrientation”textDocument.lineOrientation
Description
Section titled “Description”The Text layer’s line orientation, in general horizontal vs vertical, which affects how all text in the layer is composed.
A LineOrientation
enumerated value; read/write. One of:
LineOrientation.HORIZONTAL
LineOrientation.VERTICAL_RIGHT_TO_LEFT
LineOrientation.VERTICAL_LEFT_TO_RIGHT
TextDocument.noBreak
Section titled “TextDocument.noBreak”textDocument.noBreak
Description
Section titled “Description”The Text layer’s no break attribute.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Boolean; read/write.
TextDocument.paragraphCount
Section titled “TextDocument.paragraphCount”textDocument.paragraphCount
Description
Section titled “Description”Returns the number of paragraphs in the text layer, always greater than or equal to 1.
Integer; read-only.
TextDocument.pointText
Section titled “TextDocument.pointText”textDocument.pointText
Description
Section titled “Description”true
if a Text layer is a layer of point (unbounded) text; otherwise false
.
Boolean; read-only.
TextDocument.smallCaps
Section titled “TextDocument.smallCaps”textDocument.smallCaps
Description
Section titled “Description”true
if a Text layer has small caps enabled; otherwise false
. To set this value, use TextDocument.fontCapsOption added in After Effects 24.0.
This value only reflects the first character in the Text layer.
Boolean; read-only.
TextDocument.spaceAfter
Section titled “TextDocument.spaceAfter”textDocument.spaceAfter
Description
Section titled “Description”The Text layer’s paragraph space after option.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
Floating-point value; read/write.
TextDocument.spaceBefore
Section titled “TextDocument.spaceBefore”textDocument.spaceBefore
Description
Section titled “Description”The Text layer’s paragraph space before option.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
Floating-point value; read/write.
TextDocument.startIndent
Section titled “TextDocument.startIndent”textDocument.startIndent
Description
Section titled “Description”The Text layer’s paragraph start indent option.
If this attribute has a mixed value, it will be read as undefined
.
This value reflects all paragraphs in the Text layer.
If you change this value, it will set all paragraphs in the Text layer to the specified setting.
Floating-point value; read/write.
TextDocument.strokeColor
Section titled “TextDocument.strokeColor”textDocument.strokeColor
Description
Section titled “Description”The Text layer’s stroke color, as an array of [r, g, b] floating-point values. For example, in an 8-bpc project, a red value of 255 would be 1.0, and in a 32-bpc project, an overbright blue value can be something like 3.2.
Throws an exception on read if applyStroke is not true
.
Setting this value will also set applyStroke to true
across the affected characters.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Array [r, g, b] of floating-point values; read/write.
TextDocument.strokeOverFill
Section titled “TextDocument.strokeOverFill”textDocument.strokeOverFill
Description
Section titled “Description”Indicates the rendering order for the fill and stroke of a Text layer. When true
, the stroke appears over the fill.
The Text layer can override the per-character attribute setting if the Text layer is set to use All Strokes Over All Fills or All Fills Over All Strokes in the Character Panel. Thus the value returned here might be different than the actual attribute value set on the character. It is possible to set the Fill/Stroke render order via the “Fill & Stroke” property under More Options on the Text layer using TextLayer.text(“ADBE Text More Options”)(“ADBE Text Render Order”).
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Boolean; read/write.
TextDocument.strokeWidth
Section titled “TextDocument.strokeWidth”textDocument.strokeWidth
Description
Section titled “Description”The Text layer’s stroke thickness in pixels.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
The minimum accepted value to set is 0, but this will be silently clipped to 0.01.
Floating-point value (0 to 1000, inclusive); read/write.
TextDocument.subscript
Section titled “TextDocument.subscript”textDocument.subscript
Description
Section titled “Description”true
if a Text layer has subscript enabled; otherwise false
. To set this value, use TextDocument.fontBaselineOption added in After Effects 24.0.
This value only reflects the first character in the Text layer.
Boolean; read-only.
TextDocument.superscript
Section titled “TextDocument.superscript”textDocument.superscript
Description
Section titled “Description”true
if a Text layer has superscript enabled; otherwise false
. To set this value, use TextDocument.fontBaselineOption added in After Effects 24.0.
This value only reflects the first character in the Text layer.
Boolean; read-only.
TextDocument.text
Section titled “TextDocument.text”textDocument.text
Description
Section titled “Description”The text value for the Text layer’s Source Text property.
String; read/write.
TextDocument.tracking
Section titled “TextDocument.tracking”textDocument.tracking
Description
Section titled “Description”The Text layer’s spacing between characters.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Floating-point value; read/write.
TextDocument.tsume
Section titled “TextDocument.tsume”textDocument.tsume
Description
Section titled “Description”This Text layer’s tsume value as a normalized percentage, from 0.0 -> 1.0.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
This attribute accepts values from 0.0 -> 100.0, however the value IS expecting a normalized value from 0.0 -> 1.0. Using a value higher than 1.0 will produce unexpected results; AE’s Character Panel will clamp the value at 100%, despite the higher value set by scripting (ie TextDocument.tsume = 100
_really_ sets a value of 10,000%)
Floating-point value; read-write.
TextDocument.verticalScale
Section titled “TextDocument.verticalScale”textDocument.verticalScale
Description
Section titled “Description”This Text layer’s vertical scale in pixels.
This value only reflects the first character in the Text layer.
If you change this value, it will set all characters in the Text layer to the specified setting.
Floating-point value; read-write.
Methods
Section titled “Methods”TextDocument.characterRange()
Section titled “TextDocument.characterRange()”textDocument.characterRange(characterStart, [signedCharacterEnd])
Description
Section titled “Description”Returns an instance of the Text layer range accessor CharacterRange.
The instance will remember the parameters passed in the constructor - they remain constant and changes to the TextDocument length may cause the instance to throw exceptions on access until the TextDocument length is changed to a length which makes the range valid again.
Use toString() to find out what the constructed parameters were.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
characterStart | Unsigned integer | Starts at zero, must be the less than or equal to the (text) length of the TextDocument object. |
signedCharacterEnd | Signed integer. | Optional. If not specified, will be computed at (characterStart + 1) . |
If set to -1 , then the CharacterRange object will dynamically calculate this on access to be equal to the (text) length of the TextDocument object. | ||
signedCharacterEnd must be greater than or equal to characterStart , and less than or equal to the (text) length of the TextDocument object. |
Throws an exception if the parameters would result in an invalid range.
It is not possible to create a CharacterRange object which spans the final carriage return in the TextDocument object.
Returns
Section titled “Returns”An instance of CharacterRange object
TextDocument.composedLineCharacterIndexesAt()
Section titled “TextDocument.composedLineCharacterIndexesAt()”textDocument.composedLineCharacterIndexesAt(characterIndex)
Description
Section titled “Description”Returns the character index bounds of a ComposedLineRange object in the Text layer.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
characterIndex | Unsigned integer | A text index in the Text layer, which will be mapped to the composed line it intersects. |
Returns
Section titled “Returns”Generic object;
Key start
will be set to text index of the start of the composed line (greater than or equal to zero).
Key end
will be set to text index of the end of the composed line (greater than start, or equal to start if it is the last composed line).
Will throw an exception if the computed start and end are outside of the current TextDocument object Remember that the composed lines are static and subsequent changes to the TextDocument object instance which changes its length may render the composed line data invalid.
TextDocument.composedLineRange()
Section titled “TextDocument.composedLineRange()”textDocument.composedLineRange(composedLineIndexStart, [signedComposedLineIndexEnd])
Description
Section titled “Description”Returns an instance of the Text layer range accessor ComposedLineRange object.
The instance will remember the parameters passed in the constructor - they remain constant and changes to the TextDocument contents may cause the instance to throw exceptions on access until the TextDocument contents are changed which makes the range valid again.
Use ComposedLineRange.toString() to find out what the constructed parameters were.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
composedLineIndexStart | Unsigned integer | Starts at zero, must be the less than the number of composed lines in the TextDocument object. |
signedComposedLineIndexEnd | Signed integer. | Optional. If not specified, will be computed at (composedLineIndexStart + 1) . |
If set to -1, then the ComposedLineRange object will dynamically calculate this on access to the last composed line of the TextDocument object. | ||
signedComposedLineIndexEnd must be greater than composedLineIndexStart , and less than or equal to the number of composed lines in the TextDocument object. |
Throws an exception if the parameters would result in an invalid range.
Remember that the composed lines are static and subsequent changes to the TextDocument object instance which changes its length may render the composed line data invalid.
Returns
Section titled “Returns”An instance of ComposedLineRange object
TextDocument.paragraphCharacterIndexesAt()
Section titled “TextDocument.paragraphCharacterIndexesAt()”textDocument.paragraphCharacterIndexesAt(characterIndex)
Description
Section titled “Description”Returns the character index bounds of a paragraph in the Text layer.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
characterIndex | Unsigned integer | A text index in the Text layer, which will be mapped to the paragraph it intersects. |
Returns
Section titled “Returns”Generic object;
Key start
will be set to text index of the start of the paragraph (greater than or equal to zero).
Key end
will be set to text index of the end of the paragraph (greater than start, or equal to start if it is the last paragraph).
TextDocument.paragraphRange()
Section titled “TextDocument.paragraphRange()”textDocument.paragraphRange(paragraphIndexStart, [signedParagraphIndexEnd])
Description
Section titled “Description”Returns an instance of the Text layer range accessor ParagraphRange object.
The instance will remember the parameters passed in the constructor - they remain constant and changes to the TextDocument contents may cause the instance to throw exceptions on access until the TextDocument contents are changed which makes the range valid again.
Use ParagraphRange.toString() to find out what the constructed parameters were.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
paragraphIndexStart | Unsigned integer | Starts at zero, must be the less than the number of paragraphs in the TextDocument object. |
signedParagraphIndexEnd | Signed integer | Optional. If not specified, will be computed at (paragraphIndexStart + 1) . |
If set to -1, then the ParagraphRange object will dynamically calculate this on access to the last paragraph of the TextDocument object. | ||
signedParagraphIndexEnd must be greater than paragraphIndexStart , and less than or equal to the number of paragraphs in the TextDocument object. |
Throws an exception if the parameters would result in an invalid range.
Returns
Section titled “Returns”An instance of ParagraphRange object
TextDocument.resetCharStyle()
Section titled “TextDocument.resetCharStyle()”textDocument.resetCharStyle()
Description
Section titled “Description”Restores all characters in the Text layer to the default text character characteristics in the Character panel.
Parameters
Section titled “Parameters”None.
Returns
Section titled “Returns”Nothing.
TextDocument.resetParagraphStyle()
Section titled “TextDocument.resetParagraphStyle()”textDocument.resetParagraphStyle()
Description
Section titled “Description”Restores all paragraphs in the Text layer to the default text paragraph characteristics in the Paragraph panel.
Parameters
Section titled “Parameters”None.
Returns
Section titled “Returns”Nothing.