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?
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
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
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.
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
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!
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.
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
Copy link to clipboard
Copied
@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