Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Different fonts in one text layer using .style

Explorer ,
Apr 20, 2023 Apr 20, 2023

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!

TOPICS
Scripting
1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2023 Apr 20, 2023

No, you can't. It's a limitation. You have to split your layers.

 

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 20, 2023 Apr 20, 2023
LATEST

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)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines