Copy link to clipboard
Copied
Hi there,
I have a lower third set up with 3 auto-sizing text boxes. The "Company Name" position is tied to the end of "Person Name".
If I use a name that has letters with ascenders and descenders the "Company Name" box gets shifted down and no longer overlaps.
Is there a way I can make it so that the "Person Name" box is always the height of a name with both ascenders and descenders even if it has none?
Expression on "size" property
s=thisComp.layer("Left - Person Name");
w=s.sourceRectAtTime().width;
h=s.sourceRectAtTime().height;
[w,h]
Expression on "position" property
var s=thisComp.layer("Left - Person Name");
var w=s.sourceRectAtTime().width/2;
var h=s.sourceRectAtTime().height/2;
var l=s.sourceRectAtTime().left;
var t=s.sourceRectAtTime().top;
[w+l,h+t];
Thanks in advanced
No worries! They can be confusing at first. 🙂
So here's your current Size expression:
s= thisComp.layer('Left - Person Name");
w=s.sourceRectAtTime().width;
h=s.sourceRectAtTime().height;
[w,h]
You're creating two variables here, one for width and one for height, which look at the other layer (Left - Person Name) to set those values.
If you want the height to be a static value instead, just enter a number for h instead of linking it to that other layer's height. So your code might i
...Copy link to clipboard
Copied
Of course you can always add custom padding values as you see fit. You may just need to branch your code and add a filter that checks for these characters in a conditional. The simpler alternative to that may be to have a separate layer of text that contains both the largest letters (presumably some umlaut like Ö and a minor g) and instead of using the actual text box' height you use that layer's height.
Mylenium
Copy link to clipboard
Copied
If it's workable to do so, it sounds like you can just set the height at a static value, instead of measuring the text layer.
Copy link to clipboard
Copied
Sorry, I am new to expressions. How do I do that and still have the box width wrap around the text that gets typed in?
Thanks
Copy link to clipboard
Copied
No worries! They can be confusing at first. 🙂
So here's your current Size expression:
s= thisComp.layer('Left - Person Name");
w=s.sourceRectAtTime().width;
h=s.sourceRectAtTime().height;
[w,h]
You're creating two variables here, one for width and one for height, which look at the other layer (Left - Person Name) to set those values.
If you want the height to be a static value instead, just enter a number for h instead of linking it to that other layer's height. So your code might instead look like this:
s= thisComp.layer('Left - Person Name");
w=s.sourceRectAtTime().width;
h=200;
[w,h]
You should be able to see what an appropriate value for h is by looking at a "good" example of this title, or you can just trial and error it a bit until you're happy.
One other alternative would be linking it to a slider control (Effects > Expression Controls) and set the slider to 200 (or whatever number is appropriate here). That would keep it parked at a constant value, but still give you easy access to the number if you needed to make small adjustments manually. Sliders can also be easily passed through as controls in a Mogrt, if that's what you're building here.
Good luck! Let us know if you need any further help.
Copy link to clipboard
Copied
Thanks for your help that I didn't realise it was that simple!
Copy link to clipboard
Copied
The solution was way simpler and I was driving myself crazy. Thank you Kyle. You're a savior.
Copy link to clipboard
Copied
Simply replace the "height" related code with a fixed value.
Mylenium
Copy link to clipboard
Copied
I'm not good at coding, but maybe it's useful to someone who stumbles upon this, you have to set the height based on the font style x height. It ignores ascenders an descenders.
Copy link to clipboard
Copied
I have coincidentally run into the same problem again! Can you explain what you mean by "font style x height"?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now