Scalable Text using labels
SrRapero720 opened this issue ยท 11 comments
scalling is possible using PoseStack#scale(0.75F, 0.75F, 0.75F)
whoever, this carries one issue, widgets dimensions is still keeped, so no the dimensions applied are still the same (wasting space)
this works on decorative/label texts just to enhance readability
this propotype shows the capability of scaling
Is this something I should add? Do you want to scale all text by 0.75 by default? Or do you mean it should be an option. It is actually quite easy to make it work with the dimensions as well.
i mean it should be an option (method)
last time we talk about you said needs a better way to implement something like that (because 1.20.1 rewrites how font rendering works)
What you can do is the scale the parent. That always works and will respect the dimensions as well. The question is do you want a scale config for labels for example?
I tried scaling parents but seems like is not working? I didn't dig much in scaling parents.
And yes, a scale config for labels is a good addition.
Create a parent, add the controls you want to scale. Do parent.setScale(0.75);
and that's it.
Released a new version which does fixes a few things about scaling and adds it to label and compiled text. Hope that works for you.
scaling for some reason get texts cropped into a new line,
i assume is caused by the missing ceiling method
GuiParents scaling on the other hands works perfectly fine
But clarifying, scaling is more like a feature for all widgets using text. In Labels, what you want (normally) is scale the text and also get a responsive width and height based on the scaled text size
Buttons on the other hand extends Label, but what i want when i scale GuiButtons i want to get scaled only the text and no the GuiButton dimensions.
To make this more clear, if i set a dimension of... lets say... 30 and i scale the Button 0.5f, it will also scale the dimensions, making that 30 into a 15
If you use GuiLabel.setScale(scale) it will not effect the dimensions of the button if it has fixed ones. Will also release a fix for the missing ceil.