How to change Font and Font Size

This was a request by an anonymous user who asked how to create automation that sets the selected text layer to a predetermined font with a custom font size.

This is how you can create the automation -

  1. loop through the active comp.
  2. check if the layer is selected.
  3. if it is selected also check if the layer “is text” property equal to true (it means that the layer is text).
  4. then set the “font” property to the name of the font (it needs to be the “real” name of the font not the displayed name, you can find the name easily with another automation), change this value to your favorite font name.
  5. set the “font size” property of the layer to a number.

How to get the “real” name of your font -
you have to use another simple utility automation to show you the font name of a selected text layer.
when showing the font through automation toolkit it will give you the different name (sometimes the name will be the same).

you can download the utility automation here -
Find Font Utility.json (5.4 KB)

Download the automation here -
Custom Text Properties.json (6.7 KB)

Please let me know if you have any question.

Thanks, may I add the question of if its possible to, to different ammounts of text, automate it being sized properly to the composition size? Or can it only be done manually?

Thanks again!

Hi @misterAE ,
I am not sure what exactly do you mean by scaling it proportionally, can you please provide an example for a situation that requires such an automation?

The other automations work wonderfully and I’ve learned how to make others based on that one, so thanks again for that.
This time, i was wondering if there is a way to automate placing the text inside the grey box, like resize it so it lies within the side limits


Thanks @misterAE,
that makes it quite complicated automation so explaining all the steps will be too hard,
I used the expressions from this tutorial (it can help you understand what I did) -

by Ukramedia.

first i search for the selected layers and make sure that the first layer is a text layer, then add 2 expressions for the text layer anchor point property and scale property just like in the tutorial.

anchor point expression -

x = sourceRectAtTime().left + sourceRectAtTime().width/2
y = sourceRectAtTime().top + sourceRectAtTime().height/2;


this code center the anchor point of the text.

scale expression -

layerIndex = %*%ReplaceThisText%*%;
xMargin = %*%ReplaceThisText1%*%;
yMargin = %*%ReplaceThisText2%*%;

ref = src.sourceRectAtTime();
refScale = src.scale * .01;
x = ref.width;
y = ref.height;

xSize = x * refScale[0] - xMargin;
ySize = y * refScale[1] - yMargin;

x = xSize / sourceRectAtTime().width * 100;
y = ySize / sourceRectAtTime().height * 100;

smallestValue = Math.min(x, y);

[smallestValue, smallestValue]

this expression scales the text based on another layer, i composed this expression from this tutorial and another expression I found online, i wanted it to work also with shaped and layers that was scaled and the expression in the tutorial wouldn’t work in that situation.

i used this strange text - %%ReplaceThisText%% - to replace this text with dynamic properties from the automation, the box layer, x margin and y margin (you can change the x and y margin at the start of the automation).

then I center the text on the box layer, deletes the expressions while preserving the new values of the for the scale and anchor point.

I hope you can use this information to better understand this automation.
make sure to select the text layer as the first selection and then select the box layer.

Automation Toolkit gif4_text to box

Download -
fit text inside layer.json (57.5 KB)

Please let me know if you have more questions.

I don’t even know how to start, you’re actually a legend, just helped me automate most of my work, I can only thank so much in words and I don’t think it would be enough.

I will be coming back to your support for sure, what is the best way to support your projects?

@misterAE I’m glad it worked! :grinning: and happy to help,
I think that the idea for this tool was really good and it might help others as well.

recommending this tool to other AE users will be the best support!


Hello! I have been trying to update your automation to work in a different way, but I just don’t have the powers, so I come to you again, as this might be usefull to alot of people if possible.

I have a text in a box layer, and the automation that you did disregards the line sizes and makes it so that the line, whatever size it is (length) fits in the box by changing the font size.

What I now propose is to make it in such a way that the font size is a fixed value, and the text if it goes beyond the limits of the box, breaks into another new line, making bulking these types of edits that go in line with eachother seem more coherent.

I thank you alot for your attention, all the best for you!

If needed some pictures for reference just say!

Hi @misterAE,
can you send some pictures?
i thinks that this functionality already exist using the text box option,
when you draw a text instead of clicking -
Automation Toolkit gif5_text to box

can you explain what’s the difference between this native functionality and the required automation?
(maybe you just want to fit this text box to the box layer)

Huh, strange, mine just gets downsized (same text in pics)


Maybe I’m missing some option that I must have turned on. I’m really sorry if that is the case.

I meant this:

Having the text at this certaing font size, and the red box being the box layer i want it to fit in.

Expected results, with the old automation and with the intended.
Old automation just lowers the size, I’m trying to make a line break, you can see in the pics the text goes down a line at different words

I couldnt send more than one pic per post sorry for the spam

Thanks for the attention!

I happy to help any time,
do you know about this text option?

I can create an automation that convert a regular text to this type of paragraph text that will fit itself automatically base on the text box size.