Question
Adjust leading with script
Since I’ve spent far to much time than is actually healthy working out why using
myTypeRef.leading = 12;just doesn’t work...
(On it’s own) - ya gotta turn out auto leading off at the same time!
So, for my future self and frustrated others I give you:
// Add a new layer in the new document
var artLayerRef = app.activeDocument.artLayers.add();
// Specify that the layer is a text layer
artLayerRef.kind = LayerKind.TEXT;
//Get a reference to the text item so that we can add the text and format it a bit
textItemRef = artLayerRef.textItem;
textItemRef.contents = "Gwen Stefani is bananas!";
textItemRef.size = 10;
// Adjust the leading
// Pour the lead, Ripley! Pour it!
textItemRef.useAutoLeading = false;
textItemRef.leading = 12;
To create text and give it a custom leading value.
