Draw text to Canvas- how can I fill the canvas with my text?

Hey Devs,

I’m trying to use Render Text to Texture using Canvas Render 2d, and so far, I’m able to draw text, and use the resulting texture in a dynamic material instance.

However, currently, I’ve only been able to draw text to the middle of the canvas. If the text is short, it wastes space around it, and if it’s too long it will continue to flow off of the canvas, which won’t work for what I need.

Is there a way to make sure that no matter how long the entry text is, it gets stretched horizontally and vertically to fit exactly to the edges of the canvas?

A visual is attached, which hopefully helps explain it better! Left is currently what I have, right is the desired result.

Thanks if you can point me in the right direction!

Size box, override width set to width of canvas. If you don’t have one, right click the text in the outliner/hierarchy and choose “wrap with”. Set text to fill. Set justification to “align text center”. Alternatively size to content. Adjusting the size of the text to the size of the canvas isn’t something UE can do dynamically for you I believe, you would need to define an alternate, acceptable option for me to give any help with that. Plus it’s going to look horrible if you stretch out text horizontally or vertically to fit a box so I would steer away from that altogether, even if it is possible.

Auto wrap text. If text is still off the sides you can define the point at which it wraps.