x


GUI.Label appers bad when font size is too big

How the question asks, when i make a gui.label with custom font and font size bigger than 20, the gui.label appears very bad. Here's an example:

alt text

Why do it appears so? Sorry for bad english, but i'm an italian guy :)

If code is needed, it's here:

GUI.Label(new Rect(rightSideCoordinate - 15 - 150, characterInformationBox.height + 10 - 30, 150, 40), "Sevenarth", makeTextStyle(Color.white, textFont, 21, TextAnchor.UpperRight));


    GUIStyle makeTextStyle(Color textColor, Font font, int fontSize, TextAnchor textAnchor)
    {
        GUIStyle gs = new GUIStyle();
        gs.normal.textColor = textColor;
        gs.font = font;
        gs.fontSize = fontSize;
        gs.alignment = textAnchor;
        return gs;
    }
error.fw.png (87.3 kB)
more ▼

asked Jun 18 '12 at 04:21 PM

Sevenarth gravatar image

Sevenarth
15 1 1 3

I don't see why you call that "bad." I actually like how it appears on both versions - the wanted result and the unwanted result. I guess it's just a personal preference, though.

Jun 18 '12 at 06:09 PM You!
(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

You could use a larger font size, so that each letter is rendered using more pixels in the internal font texture, which should bring out more details, and might reduce the y offset problems. Don't use a font size too large, as this will zero out the anti-aliasing effect at some point.

Of course you'd also need to scale down your label by the same factor, for example with GUIUtility.ScaleAroundPivot().

EDIT: Or decrease the font size, play around with the factor a bit. Also, I seem to remember that non-dynamic fonts are generally rendered at higher quality, but not sure whether that's still the case for 3.5

more ▼

answered Jun 18 '12 at 06:18 PM

Wolfram gravatar image

Wolfram
9.1k 8 20 53

(comments are locked)
10|3000 characters needed characters left

I discoreved why it appears so. Then, with Adobe Fireworks (vectorial image-making application), when i make a label, it put on it Antialiasing x8, instead on unity AA isn't applied. Is there a way to apply AA on label on Unity?

more ▼

answered Jun 18 '12 at 07:06 PM

Sevenarth gravatar image

Sevenarth
15 1 1 3

(comments are locked)
10|3000 characters needed characters left

I assume this has been solved by now, but for future reference I'll answer it, if someone else googles the same problem.

I had the exact same issue as you, the font seemed to be without AA and I could not figure out why. It worked fine with other objects but not one particular...

After hours of trying to figure it out, eventually starting to think Unity was bugged, I noticed I had accidentally instanced 6 objects on top of each other due to a silly programming error in one script. So the text appeared jagged simply because it was a whole pile of stacked text objects on top of each other. Once I removed the extra five objects everything of course looked just fine.

Maybe your issue was completely different, but my font problem looked exactly as yours. Anyway, might help someone with a similar problem.

more ▼

answered Aug 02 '12 at 03:04 AM

Pigghaj gravatar image

Pigghaj
16 5 7 7

(comments are locked)
10|3000 characters needed characters left
Your answer
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:

x3816
x161

asked: Jun 18 '12 at 04:21 PM

Seen: 748 times

Last Updated: Aug 02 '12 at 03:04 AM