Advertisement


Scale text in Illustrator


Question

I have a layer of text in illustrator. All text has a fill and an outline stroke. However, all text/words are different font size. i want to scale all text by 33% for example. I have tried, select a word (all other layers locked) - select same fill (also same fill and stroke) - transform - transform each. This does scale text but it shifts the text to different position. Any suggestions appreciated! Thanks!

2015/11/11
1
1
11/11/2015 8:27:00 PM

Accepted Answer

As @paulmz points out, the transformation point is critical for scaling to work the way you expect. However you're right to have tried to use Transform Each.

After selecting all the text objects to transform (perhaps with the direct selection tool if any of your text is in groups), you can actually set the transformation point of the Transform Each function. For left-justified text you want to select the bottom-left point, bottom-right for right-justified, etc.

Transform Each transform point


The above straightforward solution will work great if the text all has the same justification.

However, if your text has different justification settings, you can use Illustrator's scripting facility to scale text sizes.

Paste the following into a plain text file called "scale-text.js". Select the text objects you want to scale, then drop scale-text.js onto your document to run the script.

This works similarly to Transform Each, but will only affect text objects. When it runs, it asks for a percentage to scale the selected text by.

function scaleTextRecursively(collection) {
    for (var i=0; i<collection.length; i++) {
        var t = collection[i];
        if (t.typename == "TextFrame") {
            t.textRange.characterAttributes.size *= (scale/100);
        } else if (t.typename == "GroupItem") {
            // also search inside groups for more text frames
            scaleTextRecursively(t.pageItems);
        }
    }
}

var doc = app.activeDocument;

var scale = prompt("Scale selected text\nScale factor:", "100%");

if ( scale !== null ) {
    scale = parseFloat(scale);

    if (isNaN(scale)) {
        alert( "Invalid scale. Try '100%'." );
    } else {
        scaleTextRecursively(doc.selection);
    }
}
2015/11/12
2
11/12/2015 11:13:00 PM