Hi I'm currently stuck on trying to load a .ttf
font, I'm getting a GdxRuntimeException with the message: Couldn't load dependencies of asset: coastershadowfont
FileHandleResolver resolver = new InternalFileHandleResolver();
assetManager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
assetManager.setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(resolver));
FreetypeFontLoader.FreeTypeFontLoaderParameter params = new FreetypeFontLoader.FreeTypeFontLoaderParameter();
params.fontFileName = "fonts/coastershadow.ttf";
params.fontParameters.size = 30;
assetManager.load("coastershadowfont", BitmapFont.class, params);
try {
assetManager.finishLoadingAssets();
} catch (Exception exception) {
System.out.println(exception.toString());
}
Pass fileName with extension, when you call
load(...)
method onAssetManager
. FileName should be anything with extension.And get
BitmapFont
with fileName that you specified at loading time.