How do I draw transparent text?


#1

I want to draw a rectangle with text in it that “cuts out” the rectangle (i.e rectangle is transparent where the text is). Any tips on how to go about this?

TIA
/R


#2

A bit fiddly, but you can:

  • get a Path
  • add a rectangle to it
  • create a GlyphArrangement of your text, and use its createPath() to add this to your other path
  • make sure zero-winding is enabled or it’ll just be a solid block
  • fill the path

#3

Thnx Jules, works like a charm.


#4