Highlighted

Controllable Font Weights – style.setFont with an Expression Selector

New Here ,
Oct 01, 2020

Copy link to clipboard

Copied

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!

To my knowledge you still can't bold parts of a sentance using expressions in AE you'll just get "The Quick Brown Fox, jumps over the [Object, object]."

The closest thing you can do is hook up multple text layers that move automatically depending on the length of the previous text. You can do that using the position and sourceRectAtTime().width in the expressions.

If you want to get clever with it you could have it so one text layer thats hidden controlls the rest of the layers by using .split so if you write something like:

“The *Quick Brown Fox*, jumps over the *Lazy Dogs*”

you will get

“The Quick Brown Fox, jumps over the Lazy Dogs

TOPICS
Expressions

Views

77

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Controllable Font Weights – style.setFont with an Expression Selector

New Here ,
Oct 01, 2020

Copy link to clipboard

Copied

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!

To my knowledge you still can't bold parts of a sentance using expressions in AE you'll just get "The Quick Brown Fox, jumps over the [Object, object]."

The closest thing you can do is hook up multple text layers that move automatically depending on the length of the previous text. You can do that using the position and sourceRectAtTime().width in the expressions.

If you want to get clever with it you could have it so one text layer thats hidden controlls the rest of the layers by using .split so if you write something like:

“The *Quick Brown Fox*, jumps over the *Lazy Dogs*”

you will get

“The Quick Brown Fox, jumps over the Lazy Dogs

TOPICS
Expressions

Views

78

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 01, 2020 0
Explorer ,
Oct 02, 2020

Copy link to clipboard

Copied

To my knowledge you still can't bold parts of a sentance using expressions in AE you'll just get "The Quick Brown Fox, jumps over the [Object, object]."

The closest thing you can do is hook up multple text layers that move automatically depending on the length of the previous text. You can do that using the position and sourceRectAtTime().width in the expressions.

If you want to get clever with it you could have it so one text layer thats hidden controlls the rest of the layers by using .split so if you write something like:

“The *Quick Brown Fox*, jumps over the *Lazy Dogs*”

you will get

“The Quick Brown Fox, jumps over the Lazy Dogs

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 02, 2020 0
Explorer ,
Oct 02, 2020

Copy link to clipboard

Copied

Can't edit my post for some reason. Made this test file.

Needs a bit of work but the general idea is there.

https://we.tl/t-xxHDTJAo1k

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 02, 2020 0
Ben5FB7 LATEST
New Here ,
Oct 09, 2020

Copy link to clipboard

Copied

This is amazing, thank you. I think i can adapt this to work for my needs!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 09, 2020 0