In Libgdx you can’t simply display text like “Hello World” in Times New Roman, size 12 – you can only display bitmaps. Therefore in order to present the aforementioned phrase you have to display a bitmap with capital “H”, then lowercase “o” and so on, of the desired size and font.
But where to get such bitmaps from?
One of the solutions is to use a tool called Hiero:
You add it when installing Libgdx by ticking the “Tools”:
What happens if you have forgotten to tick it when installing Libgdx?
- Go to the main project folder (so the one without “-android”, “-desktop”, “-ios” or “-html”) and open “build.gradle” file.
- Select all your projects -> Right-click -> Gradle -> Refresh All
- Run Hiero by right-clicking your desktop project -> Run As -> Java Application -> Hiero
This is it!
If you want to use LibGDX’s built-in dialogs you need to use the skins which require font file prepared already in e.g. .png format. For Ready Steady Teddy, my puzzle game I used Hiero to generate font files for this dialog:
←Table of contents
←My apps, games and other projects