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?
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;
I'm not sure about font families.
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.
Europe, Middle East and Africa