Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Adding text in another font after a text layer

  • Adding text in another font after a text layer

  • Adam Greenberg

    February 23, 2022 at 8:28 pm

    I have used clever work arounds suggested by many in this forum, but now I wonder if there is a way to solve this for all possible variables.

    Basically I want a text in a different font to appear after a text layer. ( see pic for 3 examples )

    This layer could be 1 line or 2 lines and also we have no way of knowing which line would be the longer line, so looking at the layers width would not work here.

    Thanks so much

  • Tomas Bumbulevičius

    February 23, 2022 at 10:49 pm

    Hey Adam, few things:

    1. How distance will be decided before the “Available Now”?
    2. What about cases when second line extends to the right as much that “Available Now” might get cropped?
    3. Where you want font to be set?
    4. How it is decided if its two liner or one?

    Based on these, it might be easier to just create a new text layer and with few logic steps set its height at first or the second row

  • Adam Greenberg

    February 23, 2022 at 11:04 pm

    so. 1 this distance will be a fixed value ( example 10 pixels to the right )

    2. I have taken this into consideration and that is not a problem. which is why the text may appear on 2 lines ( or for arguments sake, 3 lines, etc… )

    3. Ill take what i can get, so the font can either be set up in the expression itself, or it can be a layer that already exists.

    4. the width will determine the amount of lines, which I can accomplish with paragraph text or a simple expression that brings up a warning if the width exceeds a certain value.

    I`’m not sure what your last sentence means. how can i set it to first or second row. ? I need for this hypothetical text ( which is always a fixed text ) to appear after my main text, which is editable by the user ) regardless of amount of lines or justification options. </p><p><br></p><p>The only way that comes close is the exression that looks at the width and puts the text at the end but sadly if the first line of text is longer than the second line, the position will be wrong because it will look at the width of the first line</p>

  • Adam Greenberg

    February 24, 2022 at 6:51 pm

    Kevin Camp had a great solution to this in another thread.


    Finding the position of the last character

    The only thing I would like to have different is to able to control the font of this extra text.

  • Adam Greenberg

    May 20, 2022 at 1:54 pm

    this has been finally solved. I’d like to give credit to Laurent Lavergne. I am including a copy of the project and the 2 lines of code;

    on the multiline text layer this needs to be added to the sourcetext;

    const theText = text.sourceText.value;

    const lines = theText.split(/\r/);

    (time < inPoint) ? lines[lines.length-1] : theText

    and on the other layer which could be anything ( a precomp, a text layer, an imported logo ), add to the position x this code;

    const posRef = thisComp.layer(“text”).transform.xPosition;

    const widthRef = thisComp.layer(“text”).sourceRectAtTime(-1, false).width;

    value + widthRef

    and to the y position this code;

    const layerRef = thisComp.layer(“text”);

    const theText = layerRef.text.sourceText;

    const lines = theText.split(/\r/);

    const numLines = lines.length -1;

    const textLeading =;

    value + numLines * textLeading

Viewing 1 - 5 of 5 posts

Log in to reply.

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