Retrieving Shadow Geometry from TextNode / TextAssembler

Hello all,

I’ve been trying to increase the shadow scale of a TextNode to have it act as sort of a stroke. I’ve been trying methods surrounding TextNode and even seeing if TextAssembler yielded anything useful, but I just can’t seem to find the shadow geometry at all. I grabbed the actual text node, but it has no children.

My workaround would be to recreate a TextNode myself and sort it behind another one and just modify the scaling, but I was wondering if there was a simpler way to go about that :slight_smile:

If I understand you correctly, I might suggest using a DynamicTextFont and setting its “outline” value as desired. (That’s what I did, at least.)

Something like this:

font = DynamicTextFont(pathToFontFile, 0)
font.setOutline(outlineColour, outlineWidth, outlineFeather)


(A note: If you find that your font ends up with a white “halo” around the outline, try setting the font’s background colour to match its outline colour. See this issue for more.)

1 Like

Awesome. Thanks! Just what I was looking for!

Additionally, I was also attempting to have a gradient for the text fg. My working approach is the use of a shader to achieve this, but is there a simpler solution?

1 Like

It’s my pleasure! :slight_smile:

As to a gradient fill, that I don’t know offhand, I’m afraid. I’m not aware of one–but that doesn’t mean that one doesn’t exist!

Offhand, I imagine that you could use texture combine modes to achieve something like that–but I doubt that doing so is simpler than a basic gradient-shader.

Sounds good, Thanks!

1 Like