FORUMS: list search recent posts

Auto Re-Sizing Text Boxes (FIXED HEIGHT) using sourceRectAtTime

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Fabio Basone
Auto Re-Sizing Text Boxes (FIXED HEIGHT) using sourceRectAtTime
on May 15, 2018 at 3:25:51 pm

Hello

I've been using the sourceRectAtTime expression to create some auto-resizing text boxes for a template I'm creating

But i've run into difficulties when using accented letters (i.e. ¿CÓMO ESTÁS?) because it changes the heights of the box

I need t keep a fixed height regardless of whether I use accented letters or overhangs (J) or underhangs (y).

I also need the space/leading between each line of text to remain constant and not vary depending on what letters I enter.
Basically, how do I fix the height of the text boxes and only have the width variable? I've attached some screenshot to illustrate the problem.





Many thanks for your help

FB


Return to posts index

Kalleheikki Kannisto
Re: Auto Re-Sizing Text Boxes (FIXED HEIGHT) using sourceRectAtTime
on May 15, 2018 at 4:00:37 pm

Accents should not in any way affect line spacing.

I would simplify the matter by parenting the shape layer to the text layer (if you need to move the texts around), then aligning the anchor point to the origin point of the text layer. This way you can calculate the width of the box directly and it will scale around the right point without having to calculate the anchor point position. For fixed line height, you can use a constant rather than calculating it. Or, if you have the need for multi-line texts, you can round the height to closest multiple of that constant.

The matter will be more complicated if you need different type sizes.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Walter Soyka
Re: Auto Re-Sizing Text Boxes (FIXED HEIGHT) using sourceRectAtTime
on May 15, 2018 at 5:38:57 pm

If you want to fix the height, replace this line:

var h = s.sourceRectAtTime(mid).height;

with this line:

var h = 89;

... in both the size and position expressions.

(That values comes from the evaluation of that expression in the UI.)

The downside of course is that the expression will no longer react to changes to the size of the layer. If you adjust the size of the type, you'll also have to adjust the expression.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index


Fabio Basone
Re: Auto Re-Sizing Text Boxes (FIXED HEIGHT) using sourceRectAtTime
on May 16, 2018 at 11:44:09 am

Hi

Thanks for your help - unfortunately, it doesn't seem to work
Now the position of the box shifts

Any of other ideas?

Thanks





Return to posts index

Kalleheikki Kannisto
Re: Auto Re-Sizing Text Boxes (FIXED HEIGHT) using sourceRectAtTime
on May 16, 2018 at 6:18:04 pm

If you disable the position and anchor point expressions and use parenting instead, with aligned box and text layer anchor points, that will take care of the position.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

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