- Home /
GUIStyle.CalcSize giving wrong answer
My understanding is that GUIStyle.CalcSize
is supposed to return the pixel size, in the given style, of the content given in the argument. However, the answer that CalcSize
gives me is much larger than the actual size of the text onscreen.
Debug.Log (ScoreStyle.CalcSize(new GUIContent("HH")));
GUI.Label(new Rect(10,10,190,40), "Best: " + highScore, ScoreStyle);
In the above code, for example, logs (52.0, 36.0)
to the console, but the glyphs rendered by GUI.Label
are only 21 pixels tall.
What could cause such a discrepancy? I'm not using anything like GUI.matrix
, and the font isn't using padding or anything.
Oh, and also the font I'm using is caps-only, so there are no descenders, and the height of each glyph is the same.
Comment