Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Setting Font and Font Size (style.setFont & style.setFontSize) AE 2020 issue

  • Setting Font and Font Size (style.setFont & style.setFontSize) AE 2020 issue

  • Ronan De Lacy

    November 21, 2019 at 2:47 pm

    Hello expressionists,

    I’m having an issue setting the font and font size with the new expression features in AE 2020.

    I have a text layer, with 2 drop down menus applied. One for the typeface, the other for font size. Both menus have a parseFloat expression applied to get there value form 2 dynamic text layers connected to a JSON file. Everything is working as it should with the parsed values.

    The issue I’m facing is that I can only set either the font-size or the type-face, but not both. Below is the expression that I’ve applied to my Source Text. Both x and y work independently, but not together.

    I think the problem is down to how I’ve structured the expression. I’ve tried to solve, but I’m lost. Any advice/help greatly appreciated.

    Thanks in advance,
    Ronan

    var x = effect("type-face")("Menu").value;
    var y = effect("font-size")("Menu").value;

    if ( x === 1 ) {
    style.setFont("Helvetica-Light");
    } else if ( x === 2 ) {
    style.setFont("Helvetica");

    } else if ( x === 3 ) {
    style.setFont("Helvetica-Bold");

    } else if ( x === 4 ) {
    style.setFont("HelveticaNeue-Thin");
    };

    if ( y === 1 ) {
    style.setFontSize(240);
    } else if (y === 2) {
    style.setFontSize(200);
    };

  • Dan Ebberts

    November 22, 2019 at 12:36 am

    I haven’t tested this, but try it this way:


    var x = effect("type-face")("Menu").value;
    var y = effect("font-size")("Menu").value;

    if ( x === 1 ) {
    style = style.setFont("Helvetica-Light");
    } else if ( x === 2 ) {
    style = style.setFont("Helvetica");
    } else if ( x === 3 ) {
    style = style.setFont("Helvetica-Bold");
    } else {
    style = style.setFont("HelveticaNeue-Thin");
    }
    if ( y === 1 ) {
    style = style.setFontSize(240);
    } else {
    style = style.setFontSize(200);
    }

    Dan

  • Ronan De Lacy

    November 22, 2019 at 8:48 am

    Dan, thanks so much. That did the trick!!

    Cheers,
    Ronan

Viewing 1 - 3 of 3 posts

Log in to reply.

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