text(txt, x, y, w, h)

Creates a text frame on the current layer on the current page in the current document. The text frame gets created in the position specified by the x and y parameters. The default document font will be used unless a font is set with the textFont() function. The default document font size will be used unless a font size is set with the textSize() function. Change the color of the text with the fill() function. The text displays in relation to the textAlign() and textYAlign() functions. The w and h parameters define a rectangular area. If a rectangle, an oval, a polygon or a graphic line are used instead of an x position, the given text will be placed in/on this shape.

Type: function

Parameter(s):

  • txt {String}:

    The text content to set in the text frame.

  • x {Number | Rectangle | Oval | Polygon | GraphicLine | TextFrame}:

    x-coordinate of text frame or item to place the text in or graphic line to place the text onto as a text path.

  • y {Number}:

    y-coordinate of text frame

  • w {Number}:

    width of text frame

  • h {Number}:

    height of text frame

Returns:

  • {TextFrame | TextPath}:

    The created text frame instance or the text path

Example(s):

Create a text frame with a Lorem ipsum text.

text(LOREM, 50, 50, 100, 200);

Place a Lorem ipsum text inside an oval shape.

var ell = ellipse(50, 50, 100, 100);
text(LOREM, ell);

Place a Lorem ipsum text as a text path onto a line.

var l = line(50, 50, 200, 80);
text(LOREM, l);