Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Can I limit only the width of a text box without creating a fixed size?

  • Can I limit only the width of a text box without creating a fixed size?

    Posted by Stephen Pickering on October 24, 2018 at 2:55 pm

    Hi there,

    I created a mogrt that works almost perfectly for what I need. I need multiple lines (sometimes only a single line, other times 5 lines). Here’s an example: https://youtu.be/78vhvjsy5-g
    It auto centers both x and y and resizes based on the text. However, because the text is not constrained in a text box, a single line of text width could extend the borders of the composition. Is there a way to allow it to have an unconstrained height (so it resizes for 1 line or 5 lines) but limit the width?

    The reason is that when I paste text into the mogrt (or if it’s a dynamically linked ae comp) I have to paste some of the text into the first line, then more text into the next line, and so on. I have to guess on where the line break should be and while it’s not too tedious, it does take a bit of time when I have several of these to do.

    Is it possible?

    Thank you,
    Stephen

    Stephen Pickering replied 7 years, 9 months ago 3 Members · 5 Replies
  • 5 Replies
  • Jeff Kay

    October 24, 2018 at 7:36 pm

    When creating the text layer, instead of simply clicking, click and drag to create a bounding box.

  • Stephen Pickering

    October 24, 2018 at 7:48 pm

    Thanks for the suggestion. That’s what I would normally do, however, I have the white background “box” scaling to match the text size, so if there is a single line, the background box is a long, short box. A 5-line paragraph would autoscale the background box to fit a much larger text block. Does that make sense?

  • Stephen Pickering

    October 24, 2018 at 8:00 pm

    We found this post: https://forums.creativecow.net/docs/forums/post.php?forumid=227&postid=27641&univpostid=27641&pview=t where Dan Ebberts posted a helpful expression:
    txt = value;
    if (thisComp.layer("Overlay TXT Here").text.sourceText.length >= 61){
    for (i = 61; i > 0; i--) if (txt[i] == " ") break;
    if (i > 0)
    txt.substr(0,i) + "\r" + txt.substr(i+1)
    else
    txt.substring(0,61) + "\r" + txt.substring(62,999);
    }else{
    txt
    }

    Dan’s expression adds a break at 61 characters, but only for the first line. We can’t figure out how to add a break for line 2, 3, etc.

    Any ideas?

  • Kalleheikki Kannisto

    October 25, 2018 at 8:20 am

    Here’s a link to a fairly convoluted solution for a similar situation, will need some adjustment for your needs. Haven’t tested in recent versions, don’t know it if works in CC2019.

    https://forums.creativecow.net/docs/forums/post.php?forumid=227&postid=33411&univpostid=33411&pview=t

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Stephen Pickering

    October 25, 2018 at 4:01 pm

    [Kalleheikki Kannisto] “Here’s a link to a fairly convoluted solution for a similar situation, will need some adjustment for your needs. Haven’t tested in recent versions, don’t know it if works in CC2019.

    https://forums.creativecow.net/docs/forums/post.php?forumid=227&postid=3341...”

    Thanks so much for posting this. We’re trying it out now but have some other expressions going on which is a bit tricky.

    Thank you again and I’ll update if I get it working the way we are hoping.

    -Stephen

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