Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Changing the font of the First Name and The Second name

  • Changing the font of the First Name and The Second name

    Posted by Alex Dinnin on January 14, 2021 at 11:46 am

    I’ve been trying to work out a way to type a name, and have the first name in one style and the surname in another.. I’ve tried to mash two expressions I found on-line together.. but they don’t appear to be working.. this is the error

    TypeError: cannot read property ‘setFont” of Undefined

    this is the expression

    txt = text.sourceText.value;

    splt = txt.split(” “);

    str = splt[0][0].style.setFont(“ESPCircular-Bold”) + splt[0].style.setFont(“ESPCircular-Book”);

    str += txt.substr(splt[0].length).toUpperCase()

    could someone please cast their eyes over this and see what the problem is.. I’m getting this error message.. could it be that I’m mixing languages ?? legacy and Java ???

    Alex Dinnin replied 5 years, 6 months ago 3 Members · 4 Replies
  • 4 Replies
  • Chris Voelz

    January 14, 2021 at 1:12 pm

    Use 2 different layers one for the first name and another for the surname. Then use a position expression to link them together.

  • Alex Dinnin

    January 14, 2021 at 2:23 pm

    Is there no way to do this with an expression.. I’m trying to keep my layers to a minimum.

    And I want to copy and paste names into the comp

  • Trent Armstrong

    January 14, 2021 at 2:47 pm

    It’s a bummer, but AE doesn’t have the ability to have two different fonts in one text layer through expressions, yet. If you’re trying to keep “layers” to a minimum and not necessarily compositions, you could do what Chris suggests. Create a Comp that has the names in the style you want, use an expression to read the comp name and split it up, then just duplicate that comp for as many of the names as you want.

    It’s not exactly what you want, but it’s a work around until that functionality is available. I’m sure there are other ways, too.

  • Alex Dinnin

    January 15, 2021 at 1:38 pm

    Thanks for your help…

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