Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change font style per character of text

  • Filip Vandueren

    August 9, 2020 at 7:41 pm

    Unfortunately 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 am

    Filip 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

    I wanted to do the same thing and I got it to work using key frames and the Source Text parameter. It seems to remember the font changes within the text later.

    Hope that helps.

  • Ronan De lacy

    January 29, 2022 at 2:10 pm

    Hey 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 pm

    Yes, 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 am

    Can you tell how to set style for particular character of text through text animator?

  • Filip Vandueren

    July 24, 2023 at 12:49 pm

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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy