I'm using libGDX for my android game in which I'm trying to use bitmap fonts. I have created .fnt and .png bitmap files using Bitmap font generator of angel code.Both .fnt and .png have been placed under same folder /asset/data in my project.
Now when I try to run my project I get exception errors. Here is my sample code -
FileHandle handle = Gdx.files.internal("data/calib.fnt");
FileHandle handle2 = Gdx.files.internal("calib_0.png");
font = new BitmapFont(handle,handle2,true);
font.draw(batchmaker, "abcdef", x,y);
The error on console looks like this (showing only relevant lines):
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Error loading font file: data/calib.fnt . . . at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.(BitmapFont.java:809) Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Invalid font file: data/calib.fnt
I do not believe this error has something to do with issue with paths, because it gives me different errors when I play around by changing the paths.
I have been trying to fix this since almost last 2 days but couldn't come up with a solution. Can someone please let me know what could be the problem or am I missing something?
Edit: Or could there be some checks in which the parameters of calib.fnt is not passing (due to upper/lower case name mismatch with libGDX lib files) ? Please help!