0
\$\begingroup\$

Is there a way I can use an OTF file with libGDX.

The following throws an exception:

gameFont = new BitmapFont(Gdx.files.internal("data/font.otf"));

Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Invalid padding.

This is the same error thrown if I were to try to use a non font file type as well. (i.e. .png .mp3 etc). I have been able to use .fnt files in the past. Is there anyway around this? Thanks.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Not directly, but you could create a font for libgdx from a .otf using the Hiero tool to convert your font, or create one at runtime but (like the author of this site says), it's something that you should try to avoid.

An example of how to load an .otf font can be found here

\$\endgroup\$
1
  • \$\begingroup\$ Thank you. I managed to use the Hiero Tool and it worked fine. I appreciate the help. \$\endgroup\$
    – Ayman
    Jun 23, 2015 at 21:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .