Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Auto Re-Sizing Text Boxes (FIXED HEIGHT) using sourceRectAtTime

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

    Posted by Fabio Basone on May 15, 2018 at 3:25 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

    Kalleheikki Kannisto replied 8 years ago 3 Members · 4 Replies
  • 4 Replies
  • Kalleheikki Kannisto

    May 15, 2018 at 4:00 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

  • Walter Soyka

    May 15, 2018 at 5:38 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   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Fabio Basone

    May 16, 2018 at 11:44 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

  • Kalleheikki Kannisto

    May 16, 2018 at 6:18 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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy