Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Modifying the text style per line using expressions?

  • Modifying the text style per line using expressions?

    Posted by Thomas Hannen on April 28, 2011 at 9:38 am

    Is there a way to change the text properties (size, bold, leading, etc) within a text object on a line by line basis?

    I’m making a project which uses a lot of text on screen (not astons, but animated text), and I’ll need to localise it for several languages.

    Using this forum page: https://forums.creativecow.net/thread/227/15319 I’ve managed to create a text file with my localised text in it, like this:

    txt = [];
    txt[0] = "Bonjour";
    txt[1] = "Pomme";
    txt[2] = "Lapin";

    I can insert a line of text into a text object using an expression like this:

    myPath = "/D/somepath/text.txt";
    $.evalFile (myPath);
    txt[0];

    Which would display “Bonjour” inside my text object.

    But what if I have a text object where I want the first line to be Bold and 32 point, and the second line to be Regular and 16 point text?

    I know I can display two lines of my text file using this code:

    myPath = "/D/somepath/text.txt";
    $.evalFile (myPath);
    txt[1] + "\r" + txt[2];

    But how would I change the text properties of each line, without duplicating the object?

    Many thanks!

    Jeroen Rommelaars replied 6 years, 10 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 28, 2011 at 2:17 pm

    Expressions don’t have access to text attributes like font, bold, leading, etc. When you create your text with a source text expression, all the characters pick up the attributes of the first character of the pre-expression text. Even if the expression is just value, all the characters pick up the formatting of the first character.

    There is a hack where, instead of using a source text expression you use a Character Value animator and an Expression selector to manipulate individual characters and maintain the original formatting, but it’s somewhat complicated.

    Dan

  • Jeroen Rommelaars

    July 17, 2019 at 12:58 pm

    Sorry to necro such an old post – but I too am looking for a way to manipulate bold/faux-bold from expressions but cant find anything. @dan, any chance you could point me in the direction of that hack you are talking about? Really curious what the possibilities would be with that!

  • Dan Ebberts

    July 17, 2019 at 1:18 pm

    I think I was referring to this thread from 10 years ago:

    https://forums.adobe.com/message/1900850#1900850

    Dan

  • Jeroen Rommelaars

    July 17, 2019 at 1:21 pm

    Oh wow, you actually found it – and quick too!
    Thanks so much!
    Ill have a good old read through – it sounds quite interesting!

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