x


GUIStyle.CalcHeight return value too short.

I'm trying to use GUIStyle.CalcHeight with my own GUIStyle, for some multi-line wordwrapped labels. Normally the number comes out too short and the last line, or the bottom of a single line of text gets clipped. If I add a background texture then it seems like most of the time the height returned works fine. I don't want to just overflow the text, beause then it might overlap the next label down.

It also doesn't seem to properly account for the font style being set to bold.

Is there a way to get accurate height?

more ▼

asked Mar 29 '12 at 12:25 AM

Curyous gravatar image

Curyous
70 10 17 19

Try adding a background texture with one pixel and zero alpha.

Mar 29 '12 at 12:38 AM syclamoth

At the moment I'm just multiplying the result by 1.2 and using that. Seems to work.

Mar 29 '12 at 01:05 AM Curyous

CalcHeight should work, although it did take some fiddling until I used it correctly. Can you show the code you're using with it?

Mar 30 '12 at 02:52 PM HazeTI

Are you adding the border values for the style to the height returned by CalcHeight? I seem to remember having to do that at one time.

Apr 13 '12 at 04:29 AM dkNinja
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3695
x2209
x111

asked: Mar 29 '12 at 12:25 AM

Seen: 588 times

Last Updated: Apr 13 '12 at 04:29 AM