-
Shape size auto-adjust to text – excluding text descenders!
Hi all
I’m designing some video brand assets for a client and as they have little knowledge of after effects it needs to be simple for them to use. With this in mind I have designed an orange “tab” (as per their branding) that sits next to text and which adjusts automatically to text height when they type something in. The tab is simply a rectangle shape layer. This works fine but they are very specific about their branding and the tab needs to stop at the baseline of the text and not include in it’s height any descenders (hang bits on y’s, p’s etc).
I can’t for the life of me think of anything to add to my expression that will do this but maybe someone knows an answer? I thought about deducting so many pixels or percentage from the height but if there are no descenders in their text then the shape will not match the baseline.
Any help would be appreciated, expressions attached below
Size expression on Rectangle path:theTextLayer = thisComp.layer("TITLE - EDIT ME");
theTextRectInfo = theTextLayer.sourceRectAtTime(time);
theWidth = 60;
theHeight = theTextRectInfo.height;
[theWidth,theHeight]Postion expression on rectangle path:
theTextLayer = thisComp.layer("TITLE - EDIT ME");
theTextRectInfo = theTextLayer.sourceRectAtTime(time);
theX = 0;
theY = theTextLayer.toComp([0,0])[1] - (theTextRectInfo.height/2);
[theX,theY]