Skip to main content
Nathan Lovell_52
Inspiring
April 22, 2015
Answered

Problem changing font size

  • April 22, 2015
  • 2 replies
  • 1882 views

Hello,

I've been working on a script and have the following line of code, where I create and want to edit the font size of the just created text. However I can't seem to get it work. I can change some of the other text properties, which is why it is stumping me.

var finishText = thisComp.layers.addText(finishTime); 

    var textProp = finishText.property("Source Text");

    var textDocument = textProp.value;

    textDocument.resetCharStyle();

    textDocument.fontSize = 36;

    textProp.setValue(textDocument);

Help appreciated! Thanks!

This topic has been closed for replies.
Correct answer Alex White

Sup Nathan,

I`ve tried the following code and it seems like everything work properly.

var thisComp = app.project.activeItem;

var finishText = thisComp.layers.addText("finishTime");   

    var textProp = finishText.property("Source Text"); 

    var textDocument = textProp.value; 

    textDocument.resetCharStyle(); 

    textDocument.fontSize = 50; 

    textProp.setValue(textDocument); 

Can you tell us your AE version?

2 replies

April 24, 2015

setValue twice can avoid this problem when you create the text layer without text string.Another method is to create the text layer with text string.I posted a thread a few days ago in this forum,so you can check for it.

Ilya217794162hc3
Participating Frequently
February 22, 2023

как

quote

I posted a thread a few days ago in this forum,so you can check for it.


By @-1

Where is this topic? Give me a link please?

Alex White
Alex WhiteCorrect answer
Legend
April 22, 2015

Sup Nathan,

I`ve tried the following code and it seems like everything work properly.

var thisComp = app.project.activeItem;

var finishText = thisComp.layers.addText("finishTime");   

    var textProp = finishText.property("Source Text"); 

    var textDocument = textProp.value; 

    textDocument.resetCharStyle(); 

    textDocument.fontSize = 50; 

    textProp.setValue(textDocument); 

Can you tell us your AE version?

Nathan Lovell_52
Inspiring
April 22, 2015

I'm using CC 2014.

I would like to point out that finishTime is a variable established earlier in my code that basically puts a stopwatch looking timer into the text layer. Any ideas as to what it might be? It still isn't working for me

Alex White
Legend
April 22, 2015

I guess the problem is under finishTime variable. Can`t tell you exactly without code example, but you can try adding .toString to this one:

var finishText = thisComp.layers.addText(finishTime.toString);