Reputation: 99
Could someone help me by advising why the last line in below code is not working? The objective is to set the font style to bold of a text layer.
var myComp = app.project.activeItem;
var myTextLayer = myComp.layer(1);
var mySourceText = myTextLayer.property("ADBE Text Properties").property("ADBE Text Document");
var myTextDoc = mySourceText.value;
myTextDoc.ScriptUIFont.style.setValue(["Bold"]);
Upvotes: 0
Views: 3035
Reputation: 1585
You need to set the textDocument.font
property to the style name (without spaces), put a dash and write a font style with a captial letter. For example "NunitoSans-Bold"
or "Montserrat-SemiBold"
Upvotes: 1
Reputation: 1440
I'm not aware of any way to change the style directly without changing the font.
You need to change the font
attribute in myTextDoc
to the desire font.
myTextDoc.font = 'Arial-BoldMT';
mySourceText.setValue(myTextDoc);
If the only change you want is to make it bold, you can use fauxBold
attribute (It's a bit different, but maybe it'll make you satisfy).
myTextDoc.fauxBold = true;
mySourceText.setValue(myTextDoc);
Upvotes: 1