FORUMS: list search recent posts

Set font of paragraph text layer?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bryan Woods
Set font of paragraph text layer?
on Nov 15, 2012 at 11:53:29 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;
}




Return to posts index


Dan Ebberts
Re: Set font of paragraph text layer?
on Nov 16, 2012 at 12:38:54 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



Return to posts index

Bryan Woods
Re: Set font of paragraph text layer?
on Nov 18, 2012 at 5:17:10 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.


Return to posts index


Dan Ebberts
Re: Set font of paragraph text layer?
on Nov 18, 2012 at 6:27:04 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



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]