Multiple font styles' baseline not aligning when text is on multiple lines
- May 31, 2023
- 1 reply
- 384 views
Ok, this might be a bit complicated, but will do my best to explain the problem I’m having.
I’ve looked a few tutorials online and I’ve tried to combine a few of them to make a very handy layout, but am having some problems.
First tutorial is this one, which allows you to control the text’s width with a slider control. Very handy!
The second tutorial is from Ukramedia (amongst many others), that allows you to control the area of the text from a shape layer. Both are fascinating and very handy!
Both work great and are no problems, until I want to throw in the possibility of changing the font weights for some of the words. I do this by duplicating the text, and changing the font weight to let’s say “Bold”.
At this point, I now have 2 identical text layers (one regular font, one bold). I then add an “Animator” property to control the opacity, and rig it up so that I can hide one or more words, then do the same with the bold layer (but opposite) so it reveals what’s being hidden by the first layer. 
In order to control all these attributes, I've added an Adjustment layer to be my master control layer. I'm calling this EG_Control. (EG as I'm actually adding these controlled properties to the Essential Graphics panel).
Putting these controls in Essential Graphics gives me the flexibility of having a different width for the text layer, as well as a different size for the text to live in different comps.

This seems to work fine when the text is on one line.

But when I add the bolded text, it does not align with the baseline of the regular text. Doesn't matter if it's just 1, 2, or 3 lines of text.



I'm happy to post the expressions being used, but it is just as easy to provide my example file (see below) to look into a bit further. I feel like using “sourceRectAtTime()” is the answer to my problem, but I just don’t know enough about expressions to get these two layers to always align to the initial text layer.
If anyone has an idea of how to resolve this, or if I’m missing a tiny line of code to always align the text to one layer, I would be extremely grateful!
Sample file
Thanks so much!
