Page 1 of 1

TextDocument object's "Leading" Property?

Posted: May 8th, 2013, 6:38 am
by BigMacGyver
Hello all,

this is my first question to this fine community. For you guys, this is probably an easy one but i can't get this one to work no matter what i tried:

All parameters for characters in a text layer seem to be adjustable by scripting with the TextDocument object, except the Leading parameter. This parameter is not listed in the AE scripting guide. But why? And how can i change this value with a script?

I tried this:

textDocument2.leading = 40;

which just returns "auto" inside of after effects, no matter what value i give it, but at the same time it does not seem to fail to recognise the property because the script continues after this line.

Is there a dependancy on another value maybe or am i just using the wrong property?

Re: TextDocument object's "Leading" Property?

Posted: May 8th, 2013, 12:11 pm
by Paul Tuersley
Leading isn't mentioned in the scripting guide because it isn't accessible through scripting, along with the text properties in the lower part of the Character panel.

The reason you can apparently set the leading value without an error is that TextDocument is an object, and in javascript you can easily add new properties to an object in this way. But that doesn't mean it will actually do anything. For example, you can use the line 'textDocument2.banana = 40' then follow that up with a 'alert(textDocument2.banana)' and it will indeed return 40.

A more general point about setting (the supported) text settings, which you may have already got from the scripting guide, is that after altering the textDoc object you then need to apply that back to the Text Source property. For example:

Code: Select all

var textDoc = textLayer.property("Text").property("Source Text").value;
textDoc.tracking = 50;
textLayer.property("Text").property("Source Text").setValue(textDoc);
Lots of people (including myself) would like more access to text settings through scripting, such as control over settings on a per character basis and access to the currently unsupported settings. The best way to add your vote to this is through Adobe's feature request form:
https://www.adobe.com/cfusion/mmform/in ... e=wishform

Paul

Re: TextDocument object's "Leading" Property?

Posted: May 14th, 2013, 2:37 am
by BigMacGyver
Thank you very much, Paul.

It is indeed odd that they made some but not all properties for text available for scripting. I guess i will participate in the vote then and try to find a workaround solution for my problem for now.