Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Set the auto leading by script.

  • Set the auto leading by script.

    Posted by Andrei Popa on October 7, 2020 at 8:54 am

    Do you guys know if there is any way to set the leading of the text to auto by script?

    If I set it to 120% of the font size, which would be auto, it just sticks with that value. If I later modify the font size, the leading does not follow.

    Andrei Popa replied 5 years, 6 months ago 4 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    October 7, 2020 at 10:02 pm

    I don’t know of any way to do that by script.

  • Andrei Popa

    October 8, 2020 at 7:55 am

    Thanks Dan!

    That coming from you pretty much assures me there is not a way to do that 😀

  • Tomas Bumbulevičius

    October 9, 2020 at 10:29 pm

    Andrei, I kind of did on hack in the past, which might help you as well:
    1. Apply Line Spacing from Text Animator.

    2. Grab whole text height by sourceRect.

    3. Get number of lines in the text, by finding line breaks.

    4. Either set expression or set value by script, to calculate approximate value needed.

    Not 100% sure if this will do what you need to, but I used this approach to space out text in a fixed height container, when number of lines varies (different thing, though)

  • Filip Vandueren

    October 12, 2020 at 8:27 pm

    I guess the script can’t add it to the layer via an expression ?

  • Andrei Popa

    October 28, 2020 at 5:27 pm

    Adding to the expression may be the only way. Some texts have complicated expressions and not that easy to modify but I’ll have to give it a try.

    I think the best solution would be to put the value on the last row in every expression. Then the script could split the expression, get the last row and put it into something like style.setText(“last row”).setAutoLeading(true).

    Thanks for the suggestion.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy