Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Auto-justifying/Auto-linebreaking text for subtitles?

  • Auto-justifying/Auto-linebreaking text for subtitles?

    Posted by Matt Chandronait on May 16, 2013 at 4:58 pm

    So I’m using a script to auto-import subtitles from a .txt file into a text layer (pt_ImportSubtitles, works great if anyone is interested! https://aescripts.com/pt_importsubtitles/) based off of timecode. It changes Source Text keyframes of a text layer. I then have the source text of that layer pick-whipped into the source text of a text box layer so that it doesn’t pass title safe. The issue that I’m running into is that I have a lot of orphans showing up. What I want is for the text box to auto-magically resize itself so that I can get from something like:

    There’s a lot of green grass around the hill that really emphasizes
    the look.

    To, instead:

    There’s a lot of green grass around the
    hill that really emphasizes the look.

    The catch, of course, is that it has to have the ability to resize itself every time the source text changes. Basically, each time the text box word wraps, it needs to auto-resize itself so that the lines match up as evenly as possible. Yes, I could go through and put in all the line breaks manually, but this project has over 1300 lines of dialog and has to be translated into 16 languages, so that’s not really a practical consideration. Am I just stuck with orphans? I’m only a basic AE scripter (Pick whip is my friend!), so I’m unable to figure this one out on my own and I haven’t found anything in search that quite does what I need.

    Matt Chandronait replied 12 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    May 16, 2013 at 7:35 pm

    It would be difficult to do something like that with expressions, which don’t have access to text extents. Assuming that the text isn’t dynamic (i.e. the source text itself isn’t animated), this could be done by a clean-up script (or a modification to your existing script). Not a simple solution, but maybe better than doing it by hand.

    Dan

  • Matt Chandronait

    May 16, 2013 at 7:56 pm

    Thanks for the response, Dan! Apologies for my ignorance, but what do you mean by a clean-up script?

  • Dan Ebberts

    May 16, 2013 at 8:24 pm

    I mean an AE script that you would run after your first script, which would optimize the line breaks for the text layers created by the first script.

    Dan

  • Matt Chandronait

    May 31, 2013 at 6:27 am

    Ah, now I understand. Well I’ll have to leave that one to my betters. Scripting is, uh, not my strong suit ;). But definitely something to keep in mind for the future as I wasn’t even aware that was a workflow possibility. Thanks!

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