ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Change font weight in scripting?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ben Christie
Change font weight in scripting?
on Nov 9, 2015 at 10:13:13 pm

Hi guys! (this is repost but was told it would be better received in this forum)

I'm hoping this is something pretty simple I am overlooking, but I am trying to find how to set the font weight via script.

Currently I have my font set up like this. But I need to choose Helvetica Neue Medium instead. Thoughts?

fpoControl.resetCharStyle();
fpoControl.fontSize = 51;
fpoControl.fillColor = [0, 0, 0];
fpoControl.font = "Helvetica Neue";
fpoControl.text = myString;
fpoControl.justification = ParagraphJustification.CENTER_JUSTIFY;
fpoDocument.setValue(fpoControl);


Return to posts index


Dan Ebberts
Re: Change font weight in scripting?
on Nov 9, 2015 at 10:50:48 pm

You may need to set the style, but the first thing to do is make sure you know the names that AE is using. Create a comp with a text layer (Layer 1) with the desired font and try this:

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;
alert(myTextDoc.font + " / " + myTextDoc.fontStyle);

Dan



Return to posts index

Ben Christie
Re: Change font weight in scripting?
on Dec 3, 2015 at 7:19:17 pm

Thanks Dan!

This worked perfectly, I was actually just using the wrong name like you thought. Sometimes it's best to start with what you know.

Thanks again!

Ben


Return to posts index


Syed Iqbal
Re: Change font weight in scripting?
on Jul 25, 2018 at 9:39:37 am

Hi
I just want to understand how to I write a very small script which could make the active layer's font style property to bold. I want to assign a keyboard shortcut to my script file later on so that I can save tons of time of doing it through mouse.

From one of Dan's code, I tried to manipulate fontStyle property by using setValue method but it does not work.

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.fontStyle = myTextDoc.fontStyle.setValue("Bold");

Again what I am trying is to set the font weight of text layer from Regular to Bold. Any help would be much appreciated.


Return to posts index

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