Skip navigation
Mars7272
Currently Being Moderated

AfterEffects Localization

Jul 23, 2012 4:36 PM

I am writing a localization script that will load in an XML with language strings to replace text in my AE composition. I need to be able to switch out font families. Is there a way to change font families through a script?

 
Replies
  • Currently Being Moderated
    Jul 23, 2012 3:29 PM   in reply to Mars7272

    You can change the font of a text layer like this:

     

    var myFontName = "MyriadPro-Regular";

    var myComp = app.project.activeItem;

    var myTextLayer = myComp.layer(1);

    var mySourceText = myTextLayer.property("Text").property("Source Text");

    var myTextDoc = mySourceText.value;

    myTextDoc.font = myFontName;

    mySourceText.setValue(myTextDoc);

     

     

    I'm not sure about font families.

     

    Dan

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 27, 2012 12:41 PM   in reply to Dan Ebberts

    You will probably need a conversion table to first read the current font settings from the text layer then use straight up conversions or regular expressions to extract the relevant parts ("Condensed, Light, Medium, Regular, Bold, etc.) to determine the size, style and weight of the new font.  Then set the value as Dan described.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points