Copy link to clipboard
Copied
I am currently working on an Essential Graphics Template for a client. For this template I need the option to change font weight inside a text layer. Attached you see a picture of my problem.
Can anyone help me with an expression to control the font weight inside a text layer? I already know, that I have to split the different font weights in seperate layers and control the main text layer via sourceRectAtTime but I can't figure out where to write the code needed for this to work.
I've seen a post, where the same topic was discussed, but because the link expired I can't see the full code of the solution to my problem. Here the link to the other post: https://community.adobe.com/t5/after-effects-discussions/controllable-font-weights-style-setfont-wit...
Thanks in advance for your help!
Copy link to clipboard
Copied
It seems you're making this unnecessarily complicated. If the layers are separate, you don't need any advanced expressions and can just link the font selection directly. Calculating the line wrapping is a whole different story, but that won't work reliably with paragraph text, anyway, given that the Adobe Type Engine does its own magic internally. You have to use conventional line text. Therefore it might help to actually know what the texts are supposed to be rather than throwing around lorem ipsum. In fact if you used a monospaced font you wouldn't even need convoluted calculations for the positioning, just manipulate the text string.
Mylenium
Copy link to clipboard
Copied
Thanks Mylenium for your reply!
As far as I read it in the other post that I linked, I have to seperate the layers so that I can make one layer "Light" and the other "Bold" font weight.
The advantage of the paragraph text would be, that the lines break automatically and it would be more customer friendly in the usage of the MOGRT.
Because the text is part of a template it can be random and I can't tell you what it exactly will be. That's why I used "lorem ipsum" as a placeholder.
And also the problem is, that the corporate fonts I have to use is not a monospaced font.
Copy link to clipboard
Copied
Then I guess you'll have to indeed run through the whole rigmarole of figuring out the indices and splicing stuff. Have you tried contacting the original author from that linked thread?
Mylenium
Copy link to clipboard
Copied
Yes I already did. But unfortunately I got no response.
Copy link to clipboard
Copied
It sounds like you're already aware that you can't mix weights/styles within a single text layer if it's part of a Mogrt template.
The best solution I've found for this limitation, which is doing essentially the same thing in a less code-y way:
While the above method isn't 100% perfect, I've used variants of this to create many highly-functional templates for many clients. Confirming exactly how the template will need to function, how long the text entries will typically be, etc. should usually allow you to design something that is functional enough without needing to over-engineer it.
Suggestions for when the above doesn't quite get you there:
Let me know if you need more direction on any of the above! Text animators are extremely powerful once you wrap your head around the (very different) way they work.
Copy link to clipboard
Copied
Hi Kyle,
Sorry for the late response and thanks for your help! The solution to solve the problem with the animator seemed pretty logical and nice to use. Unfortunately it didn’t work out with the font we had to use. Because the "Bold" typeface was using a lot more space than the "Light" one.
So we tried to solve our problem with code. As you are maybe interested how we did it. Here is the link to our AfterEffects file. (Its in german, but hopefully you can read it anyway)
To summarize what we did is to write code where the words marked with "**" in front are displaying in bold.
We split the source text in seperate layers so we can attach each word to the previous one. We had to make two seperate layers, so we can create a "newStyle" in our main layer, that is displaying.
If you want to ad a new word, because your text needs more than 7 words, you can duplicate the layers 7 and name them 8. In our original template for the client, we just added 30 layers, so there is definitely enough words to fill.
We had to write some special code with the "-", so it recognised the words with a "-" as one word. A little buggy is the effect, that you have to make a "space" before making a line break, so you don’t get an error with the counting words.
In the "Effekteinstellungen" of "Start Position" you find some settings for expression like spacing of words and the position where the text start. In the "Dropdown-Menüsteuerung" you can switch if the text will write up- or downwards.
I hope you can maybe use this input in some of your projects soon. And thanks again for your help, I’m looking forward to make a template with the text animator.
Copy link to clipboard
Copied
... ups I was logged in with the wrong account. Nevermind the message stays the same. 🙂
Copy link to clipboard
Copied
Thanks for following up!