Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects How to change text to bold using expressions?

  • How to change text to bold using expressions?

  • Maeve Tan

    September 19, 2022 at 8:43 pm

    Hi, so I’d like to make one text layer outputting a sentence with two different font style/weight, e.g “I would like this word to be bold“.
    </div><div>But I’d like to make my layer dynamic, so I can change it anytime I want. And to make the font bold I’d like to be able to use a special character to change it. Just like how we use an asterisk(*) between a word to make it bold on Whatsapp.</div><div>
    </div><div>I know to make a layer dynamic I’d have to use</div><div>thisComp.layer(“inputTextLayer”).text.sourceText;</div><div>
    </div><div>But to make the selected words of that input change to bold is what I’m stuck on. I thought I might be able to do it with .style or something and use .split(“*”) to command the text to change to bold etc.</div><div>
    </div><div>Any ideas on how this would be achieved? Thanks!</div>

  • Filip Vandueren

    September 20, 2022 at 12:38 pm

    Having the original text with asterisks in a separate layer is a good idea BTW.

    Try this for your dual-styled layer:

    • expression for sourceText:


    st =;
    st.setText( t.replace(/\*/g,'') );
    • add an animator with these properties:
      • Stroke Opacity: 100%
      • Stroke Color: expression: + [0,0,0,1];
      • Stroke Width: expression:;
        the smaller that last number, the fatter your Faux Bold, it depends on your font, anything from 8-30/40 could work (the thinner the font you start with, the higher this number will also likely be, it’s a design decision)
      • Optionally, you could add a tiny bit of tracking at about 1-2
    • remove the default Range selector from the animator and add an expression selector.
      This is the expression for the selector amount:
    upTo = textIndex;
    for (i=0; i<upTo; i++) {
    if (t[i]=="*") {
    upTo++; i++;
    bold ? 100 : 0;
Viewing 1 - 2 of 2 posts

Log in to reply.

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