Different fonts in one text layer using .style
Copy link to clipboard
Copied
Hey!
I'm currently working on an AE template for a client.
To make sure the brand guidelines are untouched, I want to hard-code all the important specs using expressions, to make accidentally changing the leading or tracking impossible.
But there's a catch: The text is two lines, and each of the lines has a different font.
But as soon as I apply any .style expression, it wipes the second font and only uses the first.
Is there a way to prevent this and use two font styles on one layer?
If that's not possible and I have to use two layers, ive tried this:
One hidden layer with the source text.
Two layers, one for each line.
First layer:
textContent = thisComp.layer("EDIT SOURCE TEXT").text.sourceText;
textContent.split("\r")[0];
Second layer:
textContent = thisComp.layer("EDIT SOURCE TEXT").text.sourceText;
"\r" + textContent.split("\r")[1];
But as soon as I try to add some styling in there
text.sourceText.style.setLeading(style.fontSize * 1.7);
It breaks and shows the "original text" of the layer – in this case nothing, since the layer is empty and takes it's content from the hidden EDIT SOURCE TEXT layer.
Ideally this would be all on one line, but if that's impossible, how do I make this work?
Thanks for your input!
Copy link to clipboard
Copied
No, you can't. It's a limitation. You have to split your layers.
Mylenium
Copy link to clipboard
Copied
Thanks for your answer!
Too bad, but that's what I was expecting. Any insights, why i cant style my layers using expressions (like I've also talked about in my post)?

