Text highlight (expression selector)Posted by Yoan Boisjoli on February 20, 2021 at 1:24 pm
Anyone have a clue on how to have custom highlighted text like in the image attached. I played with the smart highlighter preset by Ukramedia (link below) but it only add a fill colour.
I’m creating a MOGRT for a client and he wants to be able to highlight some words within a whole sentence.
I’m thinking about isolating a word and maybe using sourceRectAtTime() but then that would mean I would be using a shape layer and since I don’t know how many words will end up being selected, I can’t really use a shape layer.
My next clue is using a font thats square shaped (dingbat or something) and having anothe text layer replacing the font of the selected words.
I’d appreciate the help since I’m a bit confused!
Thanks in advance everyone!
Link to preset:
February 20, 2021 at 6:20 pm
Here’s the link to the reference image:
February 20, 2021 at 7:19 pm
The two approaches you mention are exactly how I would tackle it.
Funny enough I was working on a version today.
I posted a simple implementation a while ago that could highlight 1 word using a mask, here it is again if you like. it uses the solid composite effect with an effects mask, so you can do layer transfer modes, which enable you to do stuff like inveriting text etc.
February 20, 2021 at 9:49 pm
Thanks for replying! Your method is very clever! However, in my case, I need to be able to isolate more than a word.
I managed to make something (see file attached) where a second text layer calculates how many characters there are in the top text layer (excluding punctuation and spaces) and replaces the letter for “N” with a super heavy stroke on it so it appears like squares.
Now my next step is to rig the same set up as in the smart highlighter preset to be able to put some words in between a set of characters (i.e.: The word [color] is now in square brackets so it would be highlighted.”
The only potential issue is that some letter are thinner than the letter “N”. Like if you have a sentence with many letters “I” the highlighted part might look a bit longer.
Let me know if this makes sense to you !
Thanks and have a good day !
February 21, 2021 at 1:58 pm
Working on it. Nearly there 🙂
A solution with a second layer that renders and positions the block characters is working, but renders slowly because of many expression selectors.
So I’m better off creating an algorithm that draws multiple boxes connected with an invisible hairline inside 1 mask, based on the one I already had.
I’ll probably dinsdags it tonight.
February 21, 2021 at 5:59 pm
Oh yeah multiple boxes sounds interesting! In my case I’m trying to have a way of writing words within brackets and automatically having these words being highlighted. I’m afraid the person using the mogrt might be confused with the index numbers to control the selection area.
I’ll keep working on it and you keep working on yours hehe maybe we can compare our work 😛
oh by the way not sure I understood 100% when you wrote “I’ll probably dinsdags it tonight.”
I think dutch autocorrect got you and confused “keep working on” with “tuesdays” hahaha am I right?
February 21, 2021 at 8:54 pm
yep, “finish it tonight” 🙂
Here’s my work, still pretty slow calculation, but drawing the complex mask was even slower. Check it out:
BTW: the highlight layer needs the adobe font “Source Serif Pro”, because every font (that includes it) has a slightly different ■ (Black Square) character design.
Source Serif Pro’s is exactly 60 x 60 px at 100pt fontsize, which is used as a constant in the position and scale calculations
February 21, 2021 at 9:10 pm
Wow it looks amazing! Good job Filip!
Can’t wait to open the file as soon as I get home! ?
February 22, 2021 at 3:44 pm
FILIP ! This is amazing !!
How did you create this? Man I think it would’ve taken me ages to to come up with that solution!
The bad solution I was getting to experiment with was duplicating the text layer and have the effect shift channels to “full on” which made squares under the text thus respecting the characters width.
What is calculations? That’s the only thing I can’t get me head around!
I’m still flabbergasted haha wow ?
February 23, 2021 at 3:40 pm
Thanks Yoan 🙂
I use calculations here to copy some pixels from another layer to this layer and combine it with the alpha.
That way we get the words of the text layer, but matted by the alpha of the marker.
Then we colorize and finally, using cc blend, the original pixels of the layer (again, the marker lines) are composited under the words.
It’s a way to do compositing using effects rather than with extra layers. Usually you have to take care that the layers are of equal size, but because we are operating on continuously rasterized text-layers every layer is interpreted as composition sized.
February 23, 2021 at 3:43 pm
Oh yeah as a bonus: since the marker lines are textcharacters you can do all kinds of fancy reveal animations with them by varying the type of range selector and or adding different properties instead of just the horizontal scaling I did in the example