Skip to content

textdocument

new TextDocument(docText)

app.project.item(index).layer(index).property("Source Text").value

The TextDocument object stores a value for a TextLayer’s Source Text property. Create it with the constructor, passing the string to be encapsulated.

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);

textDocument.allCaps

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

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

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

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

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

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

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

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

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

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

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

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

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

Returns true if some part of the text did not compose into the box.

Boolean; read-only.


textDocument.boxText

true if a Text layer is a layer of paragraph (bounded) text; otherwise false.

Boolean; read-only.


textDocument.boxTextPos

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.

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

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

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

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

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

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

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

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

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

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.

var isFauxBold = myTextLayer.sourceText.value.fauxBold;

textDocument.fauxItalic

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

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

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

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

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

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

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

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

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

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

String with style information, e.g., “bold”, “italic”

This value only reflects the first character in the Text layer.

String; read-only.


textDocument.hangingRoman

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

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.

var valOfHScale = myTextLayer.sourceText.value.horizontalScale;

textDocument.justification

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

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

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.

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

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

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

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

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

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

Returns the number of paragraphs in the text layer, always greater than or equal to 1.

Integer; read-only.


textDocument.pointText

true if a Text layer is a layer of point (unbounded) text; otherwise false.

Boolean; read-only.


textDocument.smallCaps

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

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

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

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

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

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

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

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

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

The text value for the Text layer’s Source Text property.

String; read/write.


textDocument.tracking

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

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

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.


textDocument.characterRange(characterStart, [signedCharacterEnd])

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.

ParameterTypeDescription
characterStartUnsigned integerStarts at zero, must be the less than or equal to the (text) length of the TextDocument object.
signedCharacterEndSigned 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.

An instance of CharacterRange object


TextDocument.composedLineCharacterIndexesAt()

Section titled “TextDocument.composedLineCharacterIndexesAt()”

textDocument.composedLineCharacterIndexesAt(characterIndex)

Returns the character index bounds of a ComposedLineRange object in the Text layer.

ParameterTypeDescription
characterIndexUnsigned integerA text index in the Text layer, which will be mapped to the composed line it intersects.

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(composedLineIndexStart, [signedComposedLineIndexEnd])

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.

ParameterTypeDescription
composedLineIndexStartUnsigned integerStarts at zero, must be the less than the number of composed lines in the TextDocument object.
signedComposedLineIndexEndSigned 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.

An instance of ComposedLineRange object


TextDocument.paragraphCharacterIndexesAt()

Section titled “TextDocument.paragraphCharacterIndexesAt()”

textDocument.paragraphCharacterIndexesAt(characterIndex)

Returns the character index bounds of a paragraph in the Text layer.

ParameterTypeDescription
characterIndexUnsigned integerA text index in the Text layer, which will be mapped to the paragraph it intersects.

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(paragraphIndexStart, [signedParagraphIndexEnd])

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.

ParameterTypeDescription
paragraphIndexStartUnsigned integerStarts at zero, must be the less than the number of paragraphs in the TextDocument object.
signedParagraphIndexEndSigned integerOptional. 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.

An instance of ParagraphRange object


textDocument.resetCharStyle()

Restores all characters in the Text layer to the default text character characteristics in the Character panel.

None.

Nothing.


textDocument.resetParagraphStyle()

Restores all paragraphs in the Text layer to the default text paragraph characteristics in the Paragraph panel.

None.

Nothing.