Controllable Font Weights – style.setFont with an Expression Selector
I’m trying to create a MOGRT with some unique functionality I haven’t seen anywhere else online. Our clients use two weights of font on their Video Captions (which currently they type manually) in order to highlight specific words within the text. So for example, they might like to style:
“The Quick Brown Fox, jumps over the lazy dogs”
as
“The Quick Brown Fox, jumps over the Lazy Dogs“
The solution i’m currently using is a bit of a workaround, based on Jarle Leirpoll’s example in making Mogrts ebook.
string = thisComp.layer("Highlighted Words").text.sourceText.split("+");
result = 0;
for (i = 0; i < string.length; i++){
if (textIndex == parseInt(string[i],10)){
result = 100;
break;
}
}
result
Using this running through an expression selector in the Amount Setting, I can successfully tie this to a stroke width animator to give the characters a bit of extra thickness based on a simple code in a separate hidden text layer i.e
1+3+4+5+9+10 Applies the effect to the corresponding word. Its quite intuitive for the client to understand.
However this is a bit of a workaround and the font used with the 3.0 stroke weight doesn’t exactly match the other weight of font i’m trying to replicate. Is there a way to combine this method with something like style.setFont so that the highlighted words utilise the correct font weight?
Hopefully that all makes sense!
Any help would be greatly appreciated!
