-
Condition based on text value containing certain letters
I’ve been using this script to adjust the anchor point of my text:
layerTop = this.sourceRectAtTime().top;
layerLeft = this.sourceRectAtTime().left;
layerHeight = this.sourceRectAtTime().height;
layerWidth = this.sourceRectAtTime().width;[layerLeft + layerWidth/2, layerTop + layerHeight/2];
Works great when the text is in all caps. However, if it is lower case and contains any of the following: g,j,p,q,y
then it’s off. I can do this as it comes, but the idea of this script is that I can paste it on any text I may have and it’ll work.
So how can I modify this so that it adds or subtracts to the “layerHeight” if “text.sourceText” contains g,j,p,q or y?