Forums › Adobe After Effects Expressions › How do I set the font style for text that was concatenated with expressions?
How do I set the font style for text that was concatenated with expressions?
Oscar Obians
May 8, 2020 at 12:20 amSo I created two text layers named txt1 and txt2 respectively. But I want to display the contents of both layers in txt1, and get it to inherit the font style of txt2, while txt2 remains hidden.
txt1 reads “Hello there” in comic sans
txt2 reads “It’s a new day” in Arial-BoldWhat Expressions can I input in txt1 to ensure it not only includes the contents of txt2 (to read: Hello there It’s a new day) but also do so in Arial
Andrei Popa
May 8, 2020 at 1:20 amThe expressions can’t set different fonts for the same layer yet. I personally hope that adobe will soon make this work.
Andrei
My Envato portfolio.Oscar Obians
May 8, 2020 at 7:04 amIt came with the 2020 version of AE. https://helpx.adobe.com/after-effects/using/expressions-text-properties.html
Robert Müller
May 8, 2020 at 8:47 amWhat Andrei meant is, that you cant set two different styles for the same text layer yet. The style you set in an expression would affect all the text, even the original from txt1.
Oscar Obians
May 8, 2020 at 5:14 pmI think that’s what I’m trying to accomplish. I’m not trying to give two different styles but to make the final concatenated result appear in the specific font style.
Oscar Obians
May 8, 2020 at 10:08 pmAh! I finally got it to work. I created 3 text layers: txt1, txt2, txt3.
For illustration purposes,
txt1 says: Hello there, its
txt2 says: morning
txt3 holds the expression to concatenate txt1 & txt2.I but I also wanted txt3 to inherit the font style of txt1.
txt1=thisComp.layer("txt1").text.sourceText;
txt2=thisComp.layer("txt2").text.sourceText;
txt3=txt1+" "+txt2;
fontStyle=thisComp.layer("txt1").text.sourceText.style.font;
style.setFont(thisComp.layer("txt1").text.sourceText.style.font).setText(txt3);
Log in to reply.