Inverted font


#1

Hi All,

Is there any way to inverted a font using juce?
I want to see my font kind of chadded through a black foreground to see the background.

Thanks,
Joerg


#2

You could just create an image containing your background, and use that as the fill when you draw your text?


#3

Hi Jules,

That is exactly what I wanted, thank you!

The only thing I need to know is how to create that image from my background.
It is a transparent listbox and I have one big background image which I am using for now
but it would be better to get the background picture just from the part of the background picture
which is underneath of the current item to draw.
Creating a snapshot snapshot does not work and I couldn’t figure out how to get a image of the
background of the current listbox item.

Would you please give me another hint?

Thank you in advance!
Joerg


#4

If you’ve got complex stuff behind it, then it’d probably be better to do the opposite and fill the area around your text… That’s actually quite tricky to do, but you could probably create an inverted path from your text by using GlyphArrangement::createPath, then adding a rectangle to that path around its border, and setting the path to setUsingNonZeroWinding (false).