I'm trying to load a font in libGDX. But I can't figure out want I do wrong.
Code:
white = new BitmapFont(Gdx.files.internal("fonts/white.font"), false);
Error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Error loading font file: fonts/white.font
at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.load(BitmapFont.java:657)
at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.<init>(BitmapFont.java:469)
at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:115)
at scenes.GameMode.create(GameMode.java:61)
at scenes.GameMode.<init>(GameMode.java:45)
at com.circle.game.Circle.create(Circle.java:17)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1931)
at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.load(BitmapFont.java:480)
... 7 more
:desktop:run
com.badlogic.gdx.utils.GdxRuntimeException: Error loading font file: fonts/white.font
\$\endgroup\$white.png
file, that makes me think you want to use the three-argumentBitmapFont
constructor that takes a font file (specifying glyph positions) as well as an image file (containing the actual glyph images). Could that be it? \$\endgroup\$