Sg2.9
Creating Text Items
Index RSS

Scriptographer offers full control over Illustrator's typographic options. You can create text items, modify text ranges within text items and style typography.

Illustrator has three different kinds of Text Items: PointText, AreaText and PathText.

Point Text

The PointText item starts from a point and extends horizontally (or optionally vertically) depending on the amount of text in it.

var position = new Point(50, 50);
var textItem = new PointText(position);
textItem.content = 'This is the contents of the text item.';

To make the text of the text item run vertically, you can set its textItem.orientation property to vertical:

textItem.orientation = 'vertical';

Area Text

The PathText has text running within the shape of a path. This allows you to create blocks of text in any shape, but is used most often with rectangles.

The following example creates an Area Text item by passing a rectangle to the new AreaText(rectangle) constructor:

var topLeft = new Point(50, 100); 
var size = new Size(100, 50); 
var rectangle = new Rectangle(topLeft, size); 
 
var textItem = new AreaText(rectangle); 
textItem.content = 'This text runs within the shape of the path.';

You can also pass a path to the new AreaText(path) constructor:

var position = new Point(100, 100);
var path = new Path.Circle(position, 50);
 
var textItem = new AreaText(path); 
textItem.content = 'This text runs within the shape of the path.';

Path Text

The PathText has text running along it's path.

var position = new Point(100, 100);
var path = new Path.Circle(position, 25);

var textItem = new PathText(path);
textItem.content = 'This text runs along the path.';