I tried to use an other font than the default font for displaying text in the guiNode, but i’ve got this error:[patch]28-mrt-2011 20:30:09 com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at com.jme3.font.BitmapFont.getPageSize(BitmapFont.java:91)
at com.jme3.font.BitmapText.<init>(BitmapText.java:64)
at com.jme3.font.BitmapText.<init>(BitmapText.java:60)
at mygame.Main.simpleInitApp(Main.java:213)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:218)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:138)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:206)
at java.lang.Thread.run(Thread.java:662)[/patch]I have already checked if the directory was typed correctely, but it still won’t work.
this is my font loading code:[java]guiFont = assetManager.loadFont(“Interface/Fonts/SAMPLE.FNT”);[/java]However, if i replace the ‘SAMPLE.FNT’ part by ‘Default.fnt’, it works. I already opened the font with the windows font viewer, and there isn’t an error in the font file. How can i get this to work?
When i try to use an other font as the default font an nifty gui, it won’t work either.
How did you create the font? Are you sure its name is really all uppercase?
Ah, but where is the image that goes with the font? I can barely read the little picture above but I can see enough to know that’s missing.
pspeed said:
Ah, but where is the image that goes with the font? I can barely read the little picture above but I can see enough to know that's missing.
Do you need an image to use a font?
How can i get that image?
Where did you get the .fnt file? It should have come with an image or it is not the right kind of font. The .fnt files that jME3 supports are the angelfire (sp?) format where the .fnt file is just a description of where to find the letters in an associated image file.
…somewhere there is a tutorial on making these but I don’t have the link handy. jMP recently got a plug-in to make these, too.
Yeah, if you use latest nightly of jMP, just press “New File” and select GUI → Font to create a font. You have to install the “Font Creator” plugin before.
pspeed said:
Where did you get the .fnt file? It should have come with an image or it is not the right kind of font. The .fnt files that jME3 supports are the angelfire (sp?) format where the .fnt file is just a description of where to find the letters in an associated image file.
I just used a .fnt file like the ones that windows uses.
normen said:
Yeah, if you use latest nightly of jMP, just press "New File" and select GUI -> Font to create a font. You have to install the "Font Creator" plugin before.
I've just updated, and i can't find that plugin.
Enable the nightly update center:
And install the Font Creator:
http://imgur.com/6nhg4.png