Hello all,
THE INFO
I have a widget with a Text Box wrapped in a Scale Box.
-The Scale Box is set to Scale to Fit in both directions.
-The Text Box’s alignment is Fill Horizontally and Fill Vertically. The text is centered and set in runtime, its length ranging from 100 to 300 characters aproximately, and it is supposed to fill all the space. If the text is shorter, its size should be increased; while if it’s too long, it should be sized down to fit the box without overflowing it.
If I leave Wrap Text At as 0, the text is displayed as a single, tiny line. Enabling Auto Wrap doesn’t really make a difference. I’ve been trying to find a Wrap Text At value that is appropiate for different lengths, but it never acts as expected: the text looks too small even if there is enough space for it, or it overflows the textbox.
This is how texts of different lengths look right now, with a Wrap Text At value of 1812 (this is simply the number I have found works “less bad”, simply by trying out values, but it still has some issues):
Short text (126 characters): Looks decent, but doesn’t fill the brown box even though there is free space.
Medium text (186 characters): Keeps a reasonable size, but could fill the box better. If I reduce the window size, it becomes smaller with the other elements of the widget, but the text overflows.
Longer text (206 characters): Becomes unnecessarily small and leaves too much empty space.
Other Wrap Text At values do make longer texts look good, but of course they don’t work for smaller texts.
And this is te Scale Box size in relation to the brown box:
THE QUESTIONS
-Is there any combo of Scale Box + Wrap Text At (or any other option / setting that I’m missing out) that can make text of any length (within reason) appropiately fit, resize and not overflow its limits? I’ve read several threads and haven’t really found a good answer.
-In case there definitely isn’t an easy fix, I guess the only solution is to calculate and set Wrap Text At in runtime, depending on the text’s number of characters. However, I don’t know what value to use as a reference. What unit is this value in? It’s not number of characters nor text box sixe (in my widget, the scale box that wraps the text box is 633x249px). How do I know what value is appropiate for a certain number of characters (other than just testing different numbers)?
This little issue has been driving me nuts for a while since the text size seems to be very inconsistent, even more so if you test it on different screen sizes (it can look tiny in smaller devices even if there is enough space for it), so any help is appreciated! Thank you!
EDIT: I have just discovered there is no node to set the Wrap Text At value from the widget’s graph, so… Not sure what to do anymore