ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Modifying the text style per line using expressions?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Thomas Hannen
Modifying the text style per line using expressions?
on Apr 28, 2011 at 9:38:07 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: http://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!


Return to posts index


Dan Ebberts
Re: Modifying the text style per line using expressions?
on Apr 28, 2011 at 2:17:53 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



Return to posts index

Jeroen Rommelaars
Re: Modifying the text style per line using expressions?
on Jul 17, 2019 at 12:58:05 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!


Return to posts index


Dan Ebberts
Re: Modifying the text style per line using expressions?
on Jul 17, 2019 at 1:18:53 pm

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

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


Dan



Return to posts index

Jeroen Rommelaars
Re: Modifying the text style per line using expressions?
on Jul 17, 2019 at 1:21:17 pm

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]