Changing Font Size in GUI

I’ve been working on a GUI, and until now I’ve just used photoshop for my text, but I really need to be able to use text. The problem is its too small. Here’s my code:

function DrawLabelBottomAligned (pos : Vector2, text : String)
{
GUI.Label(Rect (pos.x, nativeVerticalResolution - pos.y, 100, 100), text);
}

I tried using a transform matrix but then it gets too pixelated. Any help greatly appreciated.

is there something blindingly obvious I’m missing, or can it not be done?

Can’t be done, at least not directly. We usually keep a few of the same fonts copied to have different import settings.

You could also scale a GUI element with GUIUtility.ScaleAroundPoint to make it bigger. It’s a pain, though…

Wow. Unity’s GUI system sucks. First they dont have alpha for images, now they dont have font size. They need to get on this for some soon release.

This is incorrect. What problem are you seeing?

Of course there’s alpha for images, and of course there’s font size. There just isn’t any dynamic font size where you get any arbitrary size from one font file. If your text is too small just import the text at a larger size.

(The lack of vector fonts is actually a blessing in disguise anyway IMO, since having to make separate font files for each size makes people keep the number of font sizes down to a bare minimum, and from a typographic point of view this is a good thing. :wink: )

–Eric

Yeah, I should’ve clarified–when I say we keep multiple fonts with different import settings, it’s the same font at different sizes: 10 point, 14 point, 18 point, etc. The texture size isn’t terrible, because it’s alpha 8-bit.

I think it would be cleaner to select point sizes in the GUI skin/style, rather than reference different fonts, but it is workable now (and you can do dynamic scaling if you absolutely need to).

How do I load it in different sizes?

So in your assets folder, do you have multiple copies of each font, maybe renamed so that they each import as a unique font?

Or is there a way to duplicate a font within the IDE and then adjust import settings on the copy that way?

For the editor, I have Lucida Grande (main gui font). I duplicated that (copy/paste), renamed it to Lucida Grande Large and changed the import settings to be 11 points rather than 10. Same for small. Etc…