In jME/Nifty, each letter is basically a Quad with a Texture on it. Scaling font-textures usually looks horrible and I guess that's why Nifty doesn't provide an option for scaling (you can scale BitmapText
in jME though).
Easiest way is to generate a new, bigger font. If you're using the jME SDK there's a built-in generator. Right click on a folder in the Projects Window and choose New -> Other -> GUI -> Font
.
I recommend a padding of 2 for X and Y. Otherwise you might see random dots in the rendered text (these are parts of other letters that are overlapping the letter box in the texture).
Sometimes there's a huge gap between the letters. You can control that by using negative values for "letter spacing".
Nifty's Textfield-Control is a composition of panels and text elements. To use a bigger font you have to redefine its style.
Grab the original nifty-textfield.xml
from your nifty-style-black.jar
or from here: https://github.com/nifty-gui/nifty-gui/blob/1.4/nifty-controls-style-black/src/main/resources/textfield/nifty-textfield.xml
Save it somewhere in your Assets/Interface folder and include it in your other XML like this:
(Make sure to include it after nifty-default-styles.xml
)
<useStyles filename="Interface/textfield.xml" />
Now you have to adjust the style. Remove the base="base-font"
attribute from the style with ID nifty-textfield#text
and add font
to the attributes
-Tag.
It should look like this:
<style id="nifty-textfield#text">
<attributes ... font="Interface/Fonts/YourFont-24.fnt" />
</style>
You probably also want to change the size of the Textfield to match the new font. Edit the other styles in this file as you need.
The Nifty Manual explains controls and styles in more detail:
http://sourceforge.net/projects/nifty-gui/files/nifty-gui/1.3.2/nifty-gui-the-manual-1.3.2.pdf/download