- Home /
Layout Groups Do Not Take Scale Into Account
I am using the Horizontal Layout Group a lot to keep elements aligned.
However, I am often using a custom Bitmap font, which uses scale to change size instead of the Font Size field. This causes issues with the layout groups, as they do not take scale into account (the layout group still thinks the element is at scale 1 and uses that width).
Is this a bug or is there another way to do this?
I think you'd need to write your own method to accommodate for that. like altering an attached LayoutElement whenever the scale changes
Example: Font preferred width = 100. I set font's rectTransform scale to 0.5, which means I need to set its LayoutElement preferredWidth to 50.
Expected Result: rectTransform is correct width based on scale and font is displaying correctly.
Actual Result: the font rectTransform is the correct width, however the text is being cut off because apparently preferredWidth itself does not take scale into account...it thinks it's preferred width needs to be 100 still in order to show all the text
Answer by enchiridion · May 19, 2017 at 01:49 PM
I solved this by opening my bitmap font.fontsettings in a text document and setting m_FontSize: from 0 to the max size my font was made at. Now I don't have to use scale anymore and can use Font Size like a normal font.
Unity does not do this when creating a new font, so keep an eye out for this!
Your answer
![](https://koobas.hobune.stream/wayback/20220612110443im_/https://answers.unity.com/themes/thub/images/avi.jpg)