Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Set font of paragraph text layer?

  • Set font of paragraph text layer?

    Posted by Bryan Woods on November 15, 2012 at 11:53 pm

    Been bangin’ my head against this one and finally decided to ask the forum. I’ve created a script that creates a certain sized paragraph text box. I also want to control the font and its size. How do I do that? I can’t seem to figure out how to call the font properties for the text box. Any suggestions?

    Here’s my current script:

    {

    var proj = app.project;
    var theComposition = proj.activeItem;
    var paraText = theComposition.layers.addBoxText([910, 140], "ParagraphText");
    var theTextLayer = theComposition.layers[1];
    var dynamText = theTextLayer.property("Text").property("Source Text").expression = "/*Path of source text file*/ n $.evalFile('/PATH/OF/TEXT/FILE/text.txt') var1+var2+var3;

    dynamText;
    }

    Dan Ebberts replied 13 years, 8 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    November 16, 2012 at 12:38 am

    Try this:

    var sourceText = theTextLayer.property(“ADBE Text Properties”).property(“ADBE Text Document”);
    var textDoc = sourceText.value;
    textDoc.font = “ArialMT”;
    theTextLayer.text.sourceText.setValue(textDoc);

    Dan

  • Bryan Woods

    November 18, 2012 at 5:17 am

    Fantastic Dan, thank you. I was looking through Adobe’s script reference and saw that .property(“ADBE Text Properties”). section, but couldn’t figure out how to get it to work for my current code.

    Do you know how to get the postscript name of the font? Just typing in “Helvetica” doesn’t seem to work, and I notice the postscript name is different from the actual name that appears in the character palette.

  • Dan Ebberts

    November 18, 2012 at 6:27 am

    One way would be to use the font in a text layer, select the layer, and run this script:

    {
    var myComp = app.project.activeItem;
    var myTextLayer = myComp.selectedLayers[0];
    var mySourceText = myTextLayer.property(“ADBE Text Properties”).property(“ADBE Text Document”);
    var myTextDoc = mySourceText.value;
    alert(myTextDoc.font);
    }

    Dan

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