createOutlines(item, [cb])

Returns an array of polygons after outlining text and optionally processes them with a callback function. Use together with pathToPoints() for getting point and bezier coordinates from outlines. If used on a text frame, all linked text frames will be converted to outlines as well.

Type: function

Parameter(s):

  • item {TextFrame | TextPath}:

    Text or TextPath to be outlined.

  • cb {Function} Optional:

    Optional: Callback function to use with each polygon. Passed arguments: obj, loopCounter

Returns:

  • {Array}:

    Returns an array of polygons.

Example(s):

Convert text to outlines

textSize(150);
var myText = text("Hello", 0, 0, width, height);
var outlines = createOutlines(myText);

Run a callback function on each resulting shape

textSize(150);
var myText = text("Hello \nWorld", 0, 0, width, height);
var outlines = createOutlines(myText, function(obj){
  var pts = pathToPoints(obj);
  println(pts.length); // check number of points
});