-
Auto centre text on y to shape layer while ignoring any accents
Hi there,
I’ve been trying to build a rig for centre-aligned text (All in CAPs) to automatically centre to a shape layer. It also needs to work for 2x lined text, so if I hit return to add a second line, it adjusts to remain vertically centred to the shape (while the shape height remains fixed).
I applied this expression to the anchor point of the text layer:
s=sourceRectAtTime();[0,s.top+s.height/2]+value;
And used this expression to the size of the shape layer:
s=thisComp.layer(“TypeLayerA”);
x=s.sourceRectAtTime(time-s.inPoint,true).width+100;
y=s.height=233;
[x,y]
It all works fine until a word has an accent, at which point the expression used to centre the text on the ‘y’ factors in the additional height attributed to the accent. This results in the baseline of the text shifting vertically out of place.
Is there a way to either factor this in (not sure if there’s an if/else type solution for this) OR a way to dismiss all accents? It also has to ignore lower hanging accents e.g. cedillas.
Any help hugely appreciated!