class_resourceimporterimagefont.rst 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/ResourceImporterImageFont.xml.
  6. .. _class_ResourceImporterImageFont:
  7. ResourceImporterImageFont
  8. =========================
  9. **Inherits:** :ref:`ResourceImporter<class_ResourceImporter>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Imports a fixed-width bitmap font where all glyphs have the same width and height.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This image-based workflow can be easier to use than :ref:`ResourceImporterBMFont<class_ResourceImporterBMFont>`, but it requires all glyphs to have the same width and height. This makes **ResourceImporterImageFont** most suited to fixed-width fonts.
  15. See also :ref:`ResourceImporterDynamicFont<class_ResourceImporterDynamicFont>`.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - `Bitmap fonts - Using fonts <../tutorials/ui/gui_using_fonts.html#bitmap-fonts>`__
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  26. | :ref:`Rect2i<class_Rect2i>` | :ref:`character_margin<class_ResourceImporterImageFont_property_character_margin>` | ``Rect2i(0, 0, 0, 0)`` |
  27. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  28. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`character_ranges<class_ResourceImporterImageFont_property_character_ranges>` | ``PackedStringArray()`` |
  29. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  30. | :ref:`int<class_int>` | :ref:`columns<class_ResourceImporterImageFont_property_columns>` | ``1`` |
  31. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`compress<class_ResourceImporterImageFont_property_compress>` | ``true`` |
  33. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  34. | :ref:`Array<class_Array>` | :ref:`fallbacks<class_ResourceImporterImageFont_property_fallbacks>` | ``[]`` |
  35. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  36. | :ref:`Rect2i<class_Rect2i>` | :ref:`image_margin<class_ResourceImporterImageFont_property_image_margin>` | ``Rect2i(0, 0, 0, 0)`` |
  37. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  38. | :ref:`int<class_int>` | :ref:`rows<class_ResourceImporterImageFont_property_rows>` | ``1`` |
  39. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  40. | :ref:`int<class_int>` | :ref:`scaling_mode<class_ResourceImporterImageFont_property_scaling_mode>` | ``2`` |
  41. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  42. .. rst-class:: classref-section-separator
  43. ----
  44. .. rst-class:: classref-descriptions-group
  45. Property Descriptions
  46. ---------------------
  47. .. _class_ResourceImporterImageFont_property_character_margin:
  48. .. rst-class:: classref-property
  49. :ref:`Rect2i<class_Rect2i>` **character_margin** = ``Rect2i(0, 0, 0, 0)``
  50. Margin applied around every imported glyph. If your font image contains guides (in the form of lines between glyphs) or if spacing between characters appears incorrect, try adjusting :ref:`character_margin<class_ResourceImporterImageFont_property_character_margin>`.
  51. .. rst-class:: classref-item-separator
  52. ----
  53. .. _class_ResourceImporterImageFont_property_character_ranges:
  54. .. rst-class:: classref-property
  55. :ref:`PackedStringArray<class_PackedStringArray>` **character_ranges** = ``PackedStringArray()``
  56. The character ranges to import from the font image. This is an array that maps each position on the image (in tile coordinates, not pixels). The font atlas is traversed from left to right and top to bottom. Characters can be specified with decimal numbers (127), hexadecimal numbers (``0x007f``) or between single quotes (``'~'``). Ranges can be specified with a hyphen between characters.
  57. For instance, ``0-127`` (or ``0x0000-0x007f``) denotes the full ASCII range. As another example, ``' '-'~'`` is equivalent to ``32-127`` and denotes the range of printable (visible) ASCII characters.
  58. Make sure :ref:`character_ranges<class_ResourceImporterImageFont_property_character_ranges>` doesn't exceed the number of :ref:`columns<class_ResourceImporterImageFont_property_columns>` \* :ref:`rows<class_ResourceImporterImageFont_property_rows>` defined. Otherwise, the font will fail to import.
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _class_ResourceImporterImageFont_property_columns:
  62. .. rst-class:: classref-property
  63. :ref:`int<class_int>` **columns** = ``1``
  64. Number of columns in the font image. See also :ref:`rows<class_ResourceImporterImageFont_property_rows>`.
  65. .. rst-class:: classref-item-separator
  66. ----
  67. .. _class_ResourceImporterImageFont_property_compress:
  68. .. rst-class:: classref-property
  69. :ref:`bool<class_bool>` **compress** = ``true``
  70. If ``true``, uses lossless compression for the resulting font.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _class_ResourceImporterImageFont_property_fallbacks:
  74. .. rst-class:: classref-property
  75. :ref:`Array<class_Array>` **fallbacks** = ``[]``
  76. List of font fallbacks to use if a glyph isn't found in this bitmap font. Fonts at the beginning of the array are attempted first.
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_ResourceImporterImageFont_property_image_margin:
  80. .. rst-class:: classref-property
  81. :ref:`Rect2i<class_Rect2i>` **image_margin** = ``Rect2i(0, 0, 0, 0)``
  82. Margin to cut on the sides of the entire image. This can be used to cut parts of the image that contain attribution information or similar.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_ResourceImporterImageFont_property_rows:
  86. .. rst-class:: classref-property
  87. :ref:`int<class_int>` **rows** = ``1``
  88. Number of rows in the font image. See also :ref:`columns<class_ResourceImporterImageFont_property_columns>`.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_ResourceImporterImageFont_property_scaling_mode:
  92. .. rst-class:: classref-property
  93. :ref:`int<class_int>` **scaling_mode** = ``2``
  94. Font scaling mode.
  95. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  96. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  97. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  98. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  99. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  100. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  101. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`