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;
mySourceText.setValue(myTextDoc);
I'm not sure about font families.
Dan
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.
North America
Europe, Middle East and Africa
Asia Pacific