I’m working on a widget that I need to display a variety of names. The names have to be the same size in the Y, but need to be able to squash down in the X in order to account for longer names. How can I do this? Using a Scale box only allows me to scale both axis’s. There doesn’t appear to be a way to only scale in one axis.
Yes. This is what they want, I’m afraid. It has to be stretched vertically and distorted, but it cannot change in the Y.
In the example you posted (and how scalebox seems to work), the text is scaling in both axis’s at the same time. Changing “stretch” just changes which axis it looks at to decide if it should scale.
Scale box was the first thing I tried.
It’s possible to achieve this using the transform settings in the text, but I can’t figure out how to tie that to a predefined size not to go over, and how to set what to scale it to if it does.
Yeah, exactly. It needing to be dynamic is the problem. We can’t know how long the names are going to be, so people can input them in real time, so we need to figure out how much to scale each name if it’s over a certain size.
The best idea I have right now is to just check how many characters are in the name, and if it’s over a certain number, scale it a certain amount. It’s not perfect, as characters can be very different sizes (“l” vs “m”, for example), but on average it should be about right.
I am using the desired size of the text. It’s pretty much pixel perfect (not really), you just need the right value. If you’re doing it run-time, you can skip Force Layout Prepass.