Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Paragraph leading expression

  • Paragraph leading expression

  • jamel ghabbara

    March 17, 2021 at 12:48 pm

    Hi Guys

    few ays ago i posted a problem about controlling paragraph bounding using expressions

    Filip Vandueren Helped me that day, thanks to him again, i didn t want to bather him with more questions, the code worked well only for one thing:
    the leading is not fixed. when i try to addl style.setLeading(…) it ruins everything.

    you can find here the project with code from Filip.

    thank a lot guys

  • Filip Vandueren

    March 18, 2021 at 9:25 am

    Hi Jamel, try this:

    fs= * 1000/effect("boxWidth")("Slider");
    ld = * 1000/effect("boxWidth")("Slider");

    Important: if you want to change leading or fontsize in the character palette, also first disable the sourceText expression!

    you can do it all in code too like this for 60/90 size/leading:

    fs= 60 * 1000/effect("boxWidth")("Slider");
    ld = 90 * 1000/effect("boxWidth")("Slider");

  • Filip Vandueren

    March 18, 2021 at 9:28 am

    Here’s a small adjustment that will support auto leading:

    fs= * 1000/effect("boxWidth")("Slider");
    ld = ( ? fs*1.2 : * 1000/effect("boxWidth")("Slider"));
  • jamel ghabbara

    March 31, 2021 at 5:49 am

    Hi Filip

    Sorry for answering a little bit late, my machine is dead last week and i had to find a way to recover my files… long story…

    i wanna thank you again and again… a lot of time

    the code works fine, but when i try to link the source text to another text it doesn’t work, can you tell me why ? ( i just changed the first line of code )


    fs= * 1000/effect(“boxWidth”)(“Slider”);

    ld = ( ? fs*1.2 : * 1000/effect(“boxWidth”)(“Slider”));


  • Filip Vandueren

    March 31, 2021 at 6:02 am

    Hi jamel, “style” is the current layer’s style, in your case it needs to be the other layer’s style.

    so the final line should be:;

  • jamel ghabbara

    March 31, 2021 at 10:18 am

    man.. i dont know who you are, but ill find you, and ill offer u a cup of coffee <3 <3

    Thanks A Lot Filip

  • jamel ghabbara

    April 4, 2021 at 3:39 am

    Hi Filip

    Just a small question:
    i want to get the right Height of the text, the problem that i don’t get the right one when i use sourceRectAtTime. for example: if the paragraph is 2 lines, even if i move a little bit the Solid to modify the bouding and the paragraph stays 2 lines, the Height changes, its supposed to stay the same value, unless the paragraph is 3 lines.

  • jamel ghabbara

    April 4, 2021 at 3:46 am


  • Filip Vandueren

    April 5, 2021 at 8:48 am

    Hi Jamel,

    The value is correct: it is the height of the sourceText. But you need to multiply a layer’s sourceRect height by scale[1]/100 to get the actual pixel-size of the layer.

    And if the layer is parented, you also need to take into account the scale of parents etc.

Viewing 1 - 9 of 9 posts

Log in to reply.

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