gui_using_fonts.rst 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .. _doc_gui_using_fonts:
  2. Using Fonts
  3. ===========
  4. Godot allows you to set specific fonts for different UI nodes.
  5. There are three different places where you can setup font usage.
  6. The first is the theme editor. Choose the node you want to set the
  7. font for and select the font tab. The second is in the inspector
  8. for control nodes under **Theme Overrides > Fonts**. And lastly in
  9. the inspector settings for themes under **Default Font**.
  10. Regardless of where you are creating the font the process is
  11. the same. Click on the font setting you want to add a font to
  12. and a dropdown will appear with two choices: **New Bitmap Font**
  13. and **New Dynamic Font**.
  14. .. image:: img/new_font.png
  15. Bitmap fonts (``.fnt``) are a format created by `BMFont <http://www.angelcode.com/products/bmfont/>`__
  16. (many BMFont compatible programs exist, like `BMGlyph <http://www.bmglyph.com/>`__).
  17. If you are using a ``.fnt`` file do not select **New Bitmap Font**.
  18. Instead, drag the file from the file system panel to the
  19. font slot. Selecting the font after adding it to the font slot
  20. gives you three settings that can be changed: **height**, **ascent**
  21. and **distance field**. Distance field fonts were never reimplemented
  22. for Godot 3 and do not work in that version.
  23. Dynamic Font supports the following formats:
  24. - TrueType (``.ttf``)
  25. - OpenType (``.otf``)
  26. - Web Open Font Format 1 (``.woff``)
  27. If you are using one of these select **New Dynamic Font**.
  28. Click on it to open its settings in the inspector. From here
  29. open the **Font** settings and add your font file to the Font
  30. Data slot. The dynamic font resource is now using the font
  31. you selected.
  32. There are several options you can adjust. **Extra Spacing** options
  33. control the spacing of characters. **Settings** control the general
  34. settings of the font.
  35. .. image:: img/dynamic_font_options.png
  36. In addition, the font data has antialiasing and hinting settings you
  37. can see if you click on it. If you want to adjust either of these
  38. you need to make the font data resource unique, then save it to a
  39. ``.tres`` file. Adjusting the font file will not work because ``.ttf``/
  40. ``.otf``/ ``.woff`` files can't contain metadata about antialiasing
  41. or hinting.
  42. If you want to use the same font again but with different settings,
  43. such as a larger size or an outline, create another dynamic font
  44. resource using the same font file, and make the adjustments that you
  45. want.