Skip to main content
Known Participant
Aug 20, 2022 6:14 PM UTC
Question

Create a Text font size based on comp size with Automation Blocks?

Hello, I am trying to make a tool: Create a Text font size based on comp size.

 

For example: comp is 540px = Font size: 105px. Not change the Scale property. Find the font size given the Width and Height of comp and length of the string.

 

I searched forums and found this script code, and it's working perfectly on the already created text layers.

https://community.adobe.com/t5/after-effects-discussions/find-the-font-size-given-the-width-and-height-of-a-comp-and-length-of-string/m-p/12588567

 

I tried to make it with Automation Blocks, but it did not work correctly.

 

Can you help to make this happen?

 

Thank you

This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

Mathias Moehl
Community Expert
Community Expert
Aug 20, 2022 7:02 PM UTC

Hi Onder,
I just added a tool to the Community Library at
Comps/Comp Size/Change Comp Size and Scale Content.xml

which does this with each currently selected text layer of the active comp:
-measures the width of the text layer
- changes the font size such that the layer width is X% of the width of the comp. (where X can be entered in a dialog)

Translate
Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Mathias Moehl
Community Expert
Community Expert
Aug 20, 2022 7:06 PM UTC

PS: manipulating text details is a bit tricky, but the tool contains some clever workarounds. In a nutshell, the keyframes blocks can give you a text in json format with all text attribute details. The tool includes
- a function which retrieves these text attributes
- a function which reads the font size from the text attributes
- a function which sets the font size of the text attribues

Those functions are probably also useful in other tools - and you should be able to write functions to get/set other text attributes in the same way.

For retrieving the text attribute json also see this tutorial.

Translate
Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
m1jackson
Inspiring
Oct 14, 2024 5:51 PM UTC

This video tutorial works great, as long as there is only one line of text. I'm trying to print out a multi paragraph block of information.

I've tried several ways of getting around it by using a replace text with paragraphs. I still get the json data as the text instead of a multiline data structure.

Is there a hard-return available in Automation Blocks text?

Any thoughts?

 

While I have you here, with the updates to the text formatting in After Effects, any plans to update Automation Blocks to better work with the (relative) newness?

Translate