-
Make a box around Text auto-adjust size
I have some text with a box (shape layer Rectangle) around it that I would like to automatically resize based on the size of the text. Mostly I just need it to resize the width since I’ll only have one line at a time and won’t be changing the font. I pieced some stuff together from other posts (see below), applying it to the Rectangle Path Size and setting the text to center align. Unfortunately it’s not very accurate. It works for some text, but can get very far off depending on number of spaces and such. Also, I’d like be able to have the text left aligned if possible. Maybe an expression on the scale of the shape layer? With the anchor point set to the same place as the text anchor point?
Thanks,
Nates = thisComp.layer("Our Historical Foundation 2").text.sourceText.length * 55;
s2 = content("Rectangle 1").content("Rectangle Path 1").size[1];
[s, s2]