Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression relating paragraph lines with font size

  • Expression relating paragraph lines with font size

    Posted by Cesar Rattoni on December 20, 2021 at 8:07 pm

    Hello everyone,

    I am trying to create a script that links the font size in a paragraph with the number of lines of the same paragraph, in the following way:

    If the number of lines is 3 or less leave the font-size value the way it is, otherwise decrease the font size until it reaches 3 lines. 

    I found Andrei Popa’s line counter, which works great, and I tried to use it with a for statement in with a setFontSize script but I kept getting error messages. 

    Any suggestions?

    Andrei Popa’s script is this one:

    L = thisComp.layer("Text Layer");

    var newStyle = L.text.sourceText.style;

    var myLeading = newStyle.autoLeading ? newStyle.fontSize * 1.2 : newStyle.leading;

    H = L.sourceRectAtTime(time, false).height;

    rowNo = Math.ceil(H / myLeading);

    rowNo;

    Cesar Rattoni replied 4 years, 4 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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