• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

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

Community Beginner ,
Aug 20, 2022 Aug 20, 2022

Copy link to clipboard

Copied

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-heig...

 

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

 

Can you help to make this happen?

 

Thank you

TOPICS
Scripting

Views

68

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2022 Aug 20, 2022

Copy link to clipboard

Copied

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)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2022 Aug 20, 2022

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines