ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Can check if a word exceeds the paragraph width?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrei Popa
Can check if a word exceeds the paragraph width?
on Jan 28, 2020 at 9:24:38 am

I am trying to create a template that uses some paragraph texts.
If I get the case that some word is too long and has to be broken, I would like to make the font smaller so it fits.

Does anyone know if I can check if a word exceeds the paragraph width by expressions?

Andrei
My Envato portfolio.


Return to posts index

Dan Ebberts
Re: Can check if a word exceeds the paragraph width?
on Jan 28, 2020 at 7:50:43 pm

The only thing I can think of would be a hack, but it might be useful. You could have a source text expression like this:

if (time < 0)
"your_extra_long_word_goes_here"
else
value;

Then you could use sourceRectAtTime() with a negative time to get the width of just that word. Then I'm not sure what you do, but hopefully that's useful...


Dan



Return to posts index

Andrei Popa
Re: Can check if a word exceeds the paragraph width?
on Jan 29, 2020 at 8:03:15 am

I think I was not clear enough, but you gave me an idea anyway.

I had a boxText paragraph that had a pretty small width. I was afraid that some words the client may use may overextend and be broken in half.

I ended up creating an invisible text layer that had as value the longest word from the boxText.
I then created a ratio variable that was botTextWidth/longestWordWidth. And i multiplicated the font size with this ratio if it were smaller than 1.

Thank for the hint.

Andrei
My Envato portfolio.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]