Skip to main content
yon1313
Known Participant
March 28, 2019
Answered

Change to font Weight (For example Arial-Bold)

  • March 28, 2019
  • 1 reply
  • 2020 views

Hello,

Im using this code and im trying to change weight font in my text layer.

var textProp = app.project.activeItem.layer(1).property("Source Text");

var textDocument = textProp.value;

textDocument.font = "Arial-Bold";

textProp.setValue(textDocument);

But this does not Changing the font to the "Arial-Bold" font,

What did I do wrong?

This topic has been closed for replies.
Correct answer Tomas Sinkunas

It's not Arial-Bold, but rather Arial-BoldMT

var textProp = app.project.activeItem.layer(1).property("Source Text");

var textDocument = textProp.value;

textDocument.font = "Arial-BoldMT";

textProp.setValue(textDocument);

1 reply

Tomas Sinkunas
Tomas SinkunasCorrect answer
Legend
March 28, 2019

It's not Arial-Bold, but rather Arial-BoldMT

var textProp = app.project.activeItem.layer(1).property("Source Text");

var textDocument = textProp.value;

textDocument.font = "Arial-BoldMT";

textProp.setValue(textDocument);

yon1313
yon1313Author
Known Participant
March 29, 2019

Thanks for your answer!

Yes it works good in this case,

But what should it do in the other situations?

like when i want the font to be "Arial-Narrow",

and "Arial-NarrowMT" not working.

So what is actually the method to work with weight font ?

Tomas Sinkunas
Legend
March 29, 2019

Well, all you have to do is:

1. Set font you like manually.

2. Run this command to see what it prints.

3. Use this value in your script.

var textProp = app.project.activeItem.layer(1).property("Source Text");

var textDocument = textProp.value;

alert(textDocument.font)