Extends Item
Inherited by PointText, PathText, AreaText
The TextItem type allows you to access and modify the text items in Illustrator documents. Its functionality is inherited by different text item types such as PointText, PathText and AreaText. They each add a layer of functionality that is unique to their type, but share the underlying properties and functions that they inherit from TextItem.
Properties
The orientation of the text in the text item.
- Returns:
- String ('horizontal', 'vertical')
Specifies whether to use optical alignment within the text item. Optical alignment hangs punctuation outside the edges of a text item.
- Returns:
- Boolean — true if the text item uses optical alignment, false otherwise
Hierarchy
Returns the next text item in a story of various linked text items. Read-only.
- Returns:
- TextItem
Returns the previous text item in a story of various linked text items. Read-only.
- Returns:
- TextItem
Range Properties
Returns the index of the first visible character of the text item. (this is the equivalent of calling TextItem.visibleRange.start) Read-only.
- Returns:
- Number
Returns the index of the last visible character of the text item. (this is the equivalent of calling TextItem.visibleRange.end) Read-only.
- Returns:
- Number
Sub Ranges
The text ranges of the words contained within the text item. Note that the returned text range includes the trailing whitespace characters of the words.
Sample code:
var text = new PointText(new Point(0,0)); text.content = 'The contents of the point text.'; var word = text.words[1]; print(word.content) // 'contents ' - note the space after 'contents';Read-only.
- Returns:
- Array of TextRange, read-only
The text ranges of the paragraphs contained within the text item. Note that the returned text range includes the trailing paragraph (\r) characters of the paragraphs.
Sample code:
var text = new PointText(new Point(0,0));
// ('\r' is the escaped character that specifies a new paragraph)
text.content = 'First paragraph\rSecond paragraph';
var paragraph = text.paragraphs[1];
print(paragraph.content) //returns 'Second paragraph';
Read-only.
- Returns:
- Array of TextRange, read-only
The text ranges of the characters contained within the text item.
Sample code:
var text = new PointText(new Point(0,0)); text.content = 'abc'; var character = text.characters[1]; print(character.content) //returns 'b';Read-only.
- Returns:
- Array of TextRange, read-only
Style Properties
The character style of the text item.
- Returns:
- CharacterStyle
The paragraph style of the text item.
- Returns:
- ParagraphStyle
Functions
Converts the text in the text item to outlines. Unlike the Illustrator 'Create Outlines' action, this won't remove the text item.
- Returns:
- Item — a Group item containing the outlined text as Path and CompoundPath items.
Text Item Linking
Links the supplied text item to this one.
- Parameters:
- next: TextItem — The text item that will be linked
- Returns:
- Boolean — true if the text item was linked, false otherwise
Returns true if the text item is linked, false otherwise
- Returns:
- Boolean
Unlinks the text item from its current story.
- Returns:
- Boolean — true if the operation as successful, false otherwise
Unlinks the text item from its current story and breaks up the story into two parts before the text item.
- Returns:
- Boolean — true if the operation as successful, false otherwise
Unlinks the text item from its current story and breaks up the story into two parts after the text item.
- Returns:
- Boolean — true if the operation as successful, false otherwise
Inheritance
- Item
-
- name
- position
- style
- selected
- fullySelected
- locked
- visible
- clipMask
- targeted
- blendMode
- opacity
- isolated
- knockout
- alphaIsShape
- data
- document
- layer
- parent
- children
- firstChild
- lastChild
- nextSibling
- previousSibling
- index
- bounds
- strokeBounds
- controlBounds
- strokeColor
- strokeWidth
- strokeCap
- strokeJoin
- dashOffset
- dashArray
- miterLimit
- strokeOverprint
- fillColor
- fillOverprint
- windingRule
- resolution
- rasterize(items[, type[, resolution, antialiasing[, width, height]]])
- remove()
- removeChildren()
- copyTo(document)
- copyTo(item)
- clone()
- getKnockout(inherited)
- reverseChildren()
- hitTest(point[, request[, tolerance]])
- hitTest(point, tolerance)
- expand([flags[, steps]])
- rasterize([type[, resolution[, antialiasing[, width, height]]]])
- hasChildren()
- isEditable()
- isValid()
- appendTop(item)
- appendBottom(item)
- moveAbove(item)
- moveBelow(item)
- isAbove(item)
- isBelow(item)
- isParent(item)
- isChild(item)
- isDescendant(item)
- isAncestor(item)
- isGroupedWith(item)
- scale(sx, sy[, center])
- scale(scale[, center])
- translate(t)
- rotate(angle[, center])
- shear(shx, shy)
- transform(matrix[, flags])