Skip to main content
Inspiring
February 23, 2026
Question

Adjust leading with script

  • February 23, 2026
  • 1 reply
  • 33 views

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.

    1 reply

    c.pfaffenbichler
    Community Expert
    Community Expert
    February 23, 2026

    Manipulating text properties in Type Layers via DOM-code offers limited options, using AM-code should provide more – though the code may not be conveniently readable. 

    Inspiring
    February 23, 2026

    I looked at the AM code but got more confused with “impliedleading” adding to the mix.

                        var idautoLeading = stringIDToTypeID( "autoLeading" );
    desc1693.putBoolean( idautoLeading, false );
    var idLdng = charIDToTypeID( "Ldng" );
    var idPnt = charIDToTypeID( "#Pnt" );
    desc1693.putUnitDouble( idLdng, idPnt, 14.000000 );
    var idimpliedLeading = stringIDToTypeID( "impliedLeading" );
    var idPnt = charIDToTypeID( "#Pnt" );
    desc1693.putUnitDouble( idimpliedLeading, idPnt, 14.000000 );