I'm working with some text callouts, built in after effects and imported into premiere as motion graphics templates. They are shape layers and a text layer. Using sourceRectAtTime I have the shape layer box adjust automatically to the text, but the width of the box never changes. Sometimes this creates an "orphaned" word on the last line.
Is it possible to code so that I can adjust the text box size in premiere so that the text flows more naturally for each graphic? Thanks!
Simply use line text and manually wrap the lines. You cannot mess with paragraph text using expressions.
Hi @Mylenium However, accessing the text box via expression would be extremely helpful. We build templates with variable text boxes. If the box is made smaller, the text should wrap differently. Up to now, this has only been possible by scaling the box smaller and offsetting the font size for the text. It creates complicated solutions. Direct access to the bounding box of the text would be much simpler! Look this Post too:
You cannot access the Text Area dimensions with sourceRectAtTime(), but you can scale or size the font to fit the shape layer box. I don't know how to achieve automated widow and orphan control, but you could add a slider that changed the global kerning or scaled the font so the Premiere Pro UI could control the text size/leading and kerning to prevent orphans.
Thank you very much for your answer! It was a bit misleading that we have a problem with widows and orphans. But the problem is this:
We need access to the bounding box of paragraph text by expression. If this were possible, we could flexibly change the width and height of paragraph texts directly. Furthermore, a precise setting of the size of the text box would be possible (currently, the box can only be set manually).
Currently we can only change the width of a paragraph text by scaling. But this also changes the size of the font. As a workaround we adjust the font size again: e.g. var txtFontSize = 100 * (100/transform.scale);
All these workarounds cause complicated solutions.
what Mylenium said. there's no access to the box text dimensions via expressions, just do it the old fashioned way and manually break the lines.