How to resize font?

How do I set the font size?



I tried textLineHeight but it makes no difference. Setting width and/or height makes no difference either.

Nifty uses bitmap fonts. They are MUCH faster to render but they are also more limited.



When you create the font its created at a certain size. When you then pick that font you are choosing both the font and the size at the same time.

I heard rumor that there was a way to scale a label in nifty for a while now. I learned nifty before this was added and moaned a few times about it but never got a chance to try it the new way. I had to resort to adding an effect to scale the label up… and some version back this broke slightly but still works enough for my purposes.

Hmm, I’d be interested to see a way to scale nifty elements as I’ve not seen one yet.



I know there is a way to set the screen resolution the screens are designed at and have nifty automatically adjust from that but that’s all I’ve seen in this area.

Here is the magic method

[java]

nifty.enableAutoScaling(width, height);

[/java]

where width and height is the resolution you used to design the screen.

This is very handy, it scales all the gui element to fit the current resolution

It’s magic to a certain degree though if you design your screen in 320 x 200 and that you display it at 1920 x 1680 don’t expect a good result.

Also a trick i used for my game is to add some glow around the letters of the bitmap fonts, it does a cheap anti-aliasing when you scale up the text.

But I remember hearing something about a way to scale the labels. If there isn’t then that’s totally lame.



You can do it with an effect but it’s a kludge and has some odd artifacts.