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

Expressions - Any way to access the maximum height of single line text layer given a font and size?

Explorer ,
Jun 11, 2020 Jun 11, 2020

Copy link to clipboard

Copied

Hi, I'm making a MOGRT with multiple text layers, each layer is 1 line of text. I want to give users ability to change the font size for each line, but when they're the same font size, I want them to be evenly spaced. Using the sourceRect height doesn't work since it changes if caps were used, if there is ascenders, etc., which makes the lines look uneven. Is there a way to access what the maximum size of the text layer WOULD be given an font and size?

TOPICS
Expressions , How to

Views

1.9K

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

correct answers 1 Correct answer

LEGEND , Jun 11, 2020 Jun 11, 2020

I don't think so. There's no way to access the actual em-box sizes and actual calculated kerning/ leading/ spacing. In that regard the Adobe type engine is a black box.

 

Mylenium

Votes

Translate

Translate
LEGEND ,
Jun 11, 2020 Jun 11, 2020

Copy link to clipboard

Copied

I don't think so. There's no way to access the actual em-box sizes and actual calculated kerning/ leading/ spacing. In that regard the Adobe type engine is a black box.

 

Mylenium

Votes

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
Explorer ,
Jun 11, 2020 Jun 11, 2020

Copy link to clipboard

Copied

Thanks, I think I will make every line follow the sourceRect height of the largest line, and then give them ability to adjust each line from there. 

Votes

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 ,
Jun 11, 2020 Jun 11, 2020

Copy link to clipboard

Copied

There is a hack you can use in some circumstances. If you use an expression like this for the source text of your text layer:

 

time < 0 ? "m" : value

it will substitute a single lower case "m" for the text at "negative time" (which means it won't be visible). (If your source text already has an expression, you'll have to combine the two expressions.)

Then you can have sourceRectAtTime() acces the text's height at a negative time to get the height of the "m":

 

thisComp.layer("text").sourceRectAtTime(-1,false).height

 

Dan

 

Votes

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
Explorer ,
Jun 11, 2020 Jun 11, 2020

Copy link to clipboard

Copied

That is a great hack! I'm worried about how it would work if it needs to allow multiple languages, but it's worth trying! Thanks!

Votes

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
Enthusiast ,
Jun 11, 2020 Jun 11, 2020

Copy link to clipboard

Copied

Negative time expressions are useful for all sorts of things you wouldn't initially think are possible in AE's text engine. I've used them for measuring the dimensions of individual characters to map per-character effects to text and to measure individual words to automate a bouncing ball for singalong lyrics, for example.

Votes

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
New Here ,
Feb 27, 2023 Feb 27, 2023

Copy link to clipboard

Copied

For anyone else coming here, i found this article helpful! Believe this answers the OP's question
https://motiondeveloper.com/blog/dealing-with-descenders

Votes

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
Adobe Employee ,
Dec 11, 2023 Dec 11, 2023

Copy link to clipboard

Copied

LATEST

@cpvoa Can you post a image of what you are trying to achieve - either here or in private mail.

 

I have a general interest in trying to reduce the number of hacks that people need to do to get text to layout the way they want and so am looking to collect data on real world use cases.

 

Thanks

Douglas Waterfall

After Effects Engineering

Votes

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