[SOLVED] Font not loaded

Hello i learn this Font Creator :: jMonkeyEngine Docs
and have error when save font
No ProjectAssetManager found!

i download bitmap font generator

generated files:
1.fnt
1_0.tga
1_1.tga

my code

        assetManager.registerLocator("./assets", FileLocator.class);

            BitmapFont guiFont = assetManager.loadFont("font/1.fnt");
            
            BitmapText helloText = new BitmapText(guiFont, false);

            helloText.setSize(guiFont.getCharSet().getRenderedSize());

            helloText.setText("Hello World");

            helloText.setLocalTranslation(300, helloText.getLineHeight(), 0);

            guiNode.attachChild(helloText);

when i run this code i have error

An exception has occurred while loading asset: font/1_0.tga (Flipped)

can you help me and send fork font for jmonkey engine?

Could you post a screenshot of the structure of your project (I.e. an expanded view showing where the assets folder is, where 1.fnt is etc).

Also, are you using a gradle project layout (that usually replaces the separate assets folder with the normal src/main/resources folder


Im sure it could be made to work with a seperate assets folder (i used to try to do that) but as you are using gradle your life will be easier if you move to a normal gradle layout and move those fonts to src/main/resources/font

i create src/main/resources/Fonts
and move files to this folder
try this code
BitmapFont guiFont = assetManager.loadFont(“Fonts/1.fnt”);

and have error
An exception has occurred while loading asset: Fonts/1_0.tga (Flipped)

Admittedly I don’t know much about fonts, but its interesting that the exception is about the 1_0.tga file while the 1.fnt file is being loaded. Does the 1.fnt file have relative references to that 1_0.tga file?

P.s. is that the whole error, “An exception has occurred while loading asset” or is there more to it? Like a stack trace or a caused by

page id=0 file=“1_0.tga”
page id=1 file=“1_1.tga”

SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
com.jme3.asset.AssetLoadException: An exception has occurred while loading asset: Fonts/1_0.tga (Flipped)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:274)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
at com.jme3.asset.DesktopAssetManager.loadTexture(DesktopAssetManager.java:407)
at com.jme3.font.plugins.BitmapFontLoader.load(BitmapFontLoader.java:102)
at com.jme3.font.plugins.BitmapFontLoader.load(BitmapFontLoader.java:170)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
at com.jme3.asset.DesktopAssetManager.loadFont(DesktopAssetManager.java:434)
at wildmagic.Battle.initialize(Battle.java:100)
at com.jme3.app.state.BaseAppState.initialize(BaseAppState.java:129)
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:332)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:362)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:258)
at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:580)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:669)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.io.IOException: Monochrome and RLE colormapped images are not supported
at com.jme3.texture.plugins.TGALoader.load(TGALoader.java:462)
at com.jme3.texture.plugins.TGALoader.load(TGALoader.java:84)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
… 15 more

Monochrome and RLE colormapped images are not supported
could you create a font for me?

Solved
I download

and generate font with png
and it works

richtea thanks

2 Likes

A note for the future: if you’d included the whole stack trace in your first post you would have gotten the right answer in the very first response.

Exceptions without a stack trace are nearly useless. It leaves out 99% of the useful information. It’s equivalent to just saying “my program doesn’t work”.

1 Like

Also for future reference. The link to the docs and the instructions are correct. But they are not applied by the OP. The font creator doesn’t create TGAs, instead PNGs and as I tested it works out of the box as per the instructions linked (Font Creator :: jMonkeyEngine Docs).