
C
HAPTER
2: The Illustrator Scripting Object Model
Text objects
23
Both
text
frame
and
story
objects have
insertion
point
and
text
selection
properties. The
text
frame
object’s properties also include the defining features of the text frame, such as:
➤
The frame
width
,
height
, and
position
➤
Whether the frame is
hidden
or
locked
➤
Whether the text is
editable
N
OTE
:
A
line
object cannot be created in a script. Your script can create
character
,
paragraph
, and
word
objects.
Text ranges
The various text objects within a text frame or story also are represented collectively by the
text
range
object. For example, a character is a text range with a length of 1, and a word is a text range that has a
space before it.
You can set the content of a
text
range
object by passing a string using the
contents
property.
Text styles
Text-style elements, like
font
,
capitalization
, and
justification
, are represented by
paragraph
attribute
and
character
attribute
objects. These attribute objects are properties of the
paragraph
style
and
character
style
objects. The
paragraph
style
and
character
style
objects have
apply
to
and
remove
methods that allow your script to assign or remove attributes in a specific paragraph,
character, or text range.
You can change the display properties of a text range by applying an appropriate style or providing local
overrides of attributes at the text or paragraph levels:
➤
character
style
objects apply to sets of one or more characters. They control character features like
font
,
alignment
,
leading
,
language
, and
capitalization
, which are properties of the
character attribute
object.
➤
paragraph
style
objects apply to paragraphs. They control paragraph features like
first
line
indent
,
left
indent
, and
right
indent
, which are properties of the
paragraph
attribute
object.