fonts.adoc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. = Font Creator
  2. :revnumber: 2.0
  3. :revdate: 2020/07/25
  4. :keywords: gui, documentation, hud
  5. This SDK plugin provides font support for jMonkeyEngine games. It creates AngelFont files from system fonts. Make sure you have the rights/license to use this font! You can link:https://www.google.com/search?q=free+fonts[search for and download free fonts] from many sites.
  6. == Installation
  7. If the plugin is installed, you see it under `Plugins → Installed`
  8. image::plugin/install-font-plugin.png[install-font-plugin.png,width="450",height="275",align="center"]
  9. (If you don't see it, go to `Tools → Plugins → Available Plugins` to install Font Creator.)
  10. == Create Font
  11. The following example creates the custom font `Orbitron.fnt` in the `assets/Interface/Fonts` directory.
  12. image::plugin/font-1.png[font-1.png,width="",height="",align="center"]
  13. image::plugin/font-2.png[font-2.png,width="",height="",align="center"]
  14. image::plugin/font-3.png[font-3.png,width="",height="",align="center"]
  15. image::plugin/font-4.png[font-4.png,width="",height="",align="center"]
  16. image::plugin/font-5.png[font-5.png,width="",height="",align="center"]
  17. == Use Font
  18. The following example loads text in the custom font `Orbitron.fnt` from the `assets/Interface/Fonts` directory. You use `com.jme3.font.*` package to handle text on the screen. `guiNode` is a preconfigured node in any `SimpleApplication`-based game.
  19. [source,java]
  20. ----
  21. BitmapFont myFont = assetManager.loadFont("Interface/Fonts/Orbitron.fnt");
  22. BitmapText hudText = new BitmapText(myFont, false);
  23. hudText.setText("You can write any string here");
  24. guiNode.attachChild(hudText);
  25. ----
  26. == create font for RTL languages like persian and arabic
  27. to create and use persian bitmap fonts use this tool.
  28. link:https://github.com/younes-noori/bitMapFontCreator[bitMapFontCreator for RTL languages]