Activity › Forums › Adobe After Effects Expressions › Change font style per character of text
-
Change font style per character of text
Posted by Anderson Gomes on August 8, 2020 at 9:08 pmHi all,
I’m working on a project where I have to make a whole bunch of text layers where each letter is a specific font style.
Any suggestions?
Thank you!
AndersonFilip Vandueren replied 3 years, 1 month ago 6 Members · 7 Replies -
7 Replies
-
Filip Vandueren
August 9, 2020 at 7:41 pmUnfortunately Expressions can only read the style at individual characters within a source text,
but only set/write one style for the entire text layer.So unless the characters are placed on separate layers (which would mean kerning issues) there’s no way to automate
-
Tomas Bumbulevičius
August 10, 2020 at 10:18 amFilip said it all spot on – its unfortunate, but its still true in 2020.
The only option to make custom style controls with expressions, would be applying text animation engine effects, and making custom ranges, to affect specific letters (if it is about the letters, otherwise – different logic). But it is a workaround, to FAKE different styles, not an actual way to set different fonts. Cheers!
Find out more:
Motion Graphics Design & After Effects Tutorials
On YT
On VH -
Raj Grainger
August 13, 2020 at 9:48 pm -
Ronan De lacy
January 29, 2022 at 2:10 pmHey Filip,
I think that I have found a solution to this, using regex expression on the source text property. For my use case, I am working with localising comps, where the target language and Latin characters will have different typefaces.
text.sourceText.style.setFont("PingFangTC-Medium");
var textIndex = text.sourceText.length;
var RE = /[a-z_ ]/gi;
txt = text.sourceText.replace(RE, function($0) {
return '~'.repeat($0.length);
});
if(txt.charAt(textIndex - 1) == '~') { style.setFont("ComicSansMS-Bold"); }
The “solution” is a bit buggy and works intermittently. Would be very interested to hear your take on it. I’ve attached a basic example project file if anyone want’s to take a look.
-
Filip Vandueren
January 29, 2022 at 8:20 pmYes, this is relying on a specific quirk, that if you switch to a font that does not contain certain Unicode characters in the sourcetext, it keeps those characters in the previous font that did contain them. The same happens when you edit the font manually.
This doesn’t help in choosing two different Chinese or two different Latin fonts though.
-
John Abbott
July 23, 2023 at 3:41 amCan you tell how to set style for particular character of text through text animator?
-
Filip Vandueren
July 24, 2023 at 12:49 pmIt can’t be done with text-animators, unless you mean using a character animator to add font stroke weight or text skewing to do faux bold / faux italics.
That case is pretty straightforward: dial in the amount of stroke you want added (you may have to also explicitly set Stroke color and stroke opacity 100 as extra properties in the same animator, then use the start and end of the range to limit what characters get Boldened)
Reply to this Discussion! Login or Sign Up

