class_resourceimporterimagefont.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/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 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, glyph advances and drawing offsets can be customized. 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:`int<class_int>` | :ref:`ascent<class_ResourceImporterImageFont_property_ascent>` | ``0`` |
  27. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  28. | :ref:`Rect2i<class_Rect2i>` | :ref:`character_margin<class_ResourceImporterImageFont_property_character_margin>` | ``Rect2i(0, 0, 0, 0)`` |
  29. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  30. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`character_ranges<class_ResourceImporterImageFont_property_character_ranges>` | ``PackedStringArray()`` |
  31. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  32. | :ref:`int<class_int>` | :ref:`columns<class_ResourceImporterImageFont_property_columns>` | ``1`` |
  33. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`compress<class_ResourceImporterImageFont_property_compress>` | ``true`` |
  35. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  36. | :ref:`int<class_int>` | :ref:`descent<class_ResourceImporterImageFont_property_descent>` | ``0`` |
  37. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  38. | :ref:`Array<class_Array>` | :ref:`fallbacks<class_ResourceImporterImageFont_property_fallbacks>` | ``[]`` |
  39. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  40. | :ref:`Rect2i<class_Rect2i>` | :ref:`image_margin<class_ResourceImporterImageFont_property_image_margin>` | ``Rect2i(0, 0, 0, 0)`` |
  41. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  42. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`kerning_pairs<class_ResourceImporterImageFont_property_kerning_pairs>` | ``PackedStringArray()`` |
  43. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  44. | :ref:`int<class_int>` | :ref:`rows<class_ResourceImporterImageFont_property_rows>` | ``1`` |
  45. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  46. | :ref:`int<class_int>` | :ref:`scaling_mode<class_ResourceImporterImageFont_property_scaling_mode>` | ``2`` |
  47. +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
  48. .. rst-class:: classref-section-separator
  49. ----
  50. .. rst-class:: classref-descriptions-group
  51. Property Descriptions
  52. ---------------------
  53. .. _class_ResourceImporterImageFont_property_ascent:
  54. .. rst-class:: classref-property
  55. :ref:`int<class_int>` **ascent** = ``0`` :ref:`🔗<class_ResourceImporterImageFont_property_ascent>`
  56. Font ascent (number of pixels above the baseline). If set to ``0``, half of the character height is used.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_ResourceImporterImageFont_property_character_margin:
  60. .. rst-class:: classref-property
  61. :ref:`Rect2i<class_Rect2i>` **character_margin** = ``Rect2i(0, 0, 0, 0)`` :ref:`🔗<class_ResourceImporterImageFont_property_character_margin>`
  62. 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>`.
  63. .. rst-class:: classref-item-separator
  64. ----
  65. .. _class_ResourceImporterImageFont_property_character_ranges:
  66. .. rst-class:: classref-property
  67. :ref:`PackedStringArray<class_PackedStringArray>` **character_ranges** = ``PackedStringArray()`` :ref:`🔗<class_ResourceImporterImageFont_property_character_ranges>`
  68. 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 ``U+007f``) or between single quotes (``'~'``). Ranges can be specified with a hyphen between characters.
  69. For example, ``0-127`` represents the full ASCII range. It can also be written as ``0x0000-0x007f`` (or ``U+0000-U+007f``). As another example, ``' '-'~'`` is equivalent to ``32-127`` and represents the range of printable (visible) ASCII characters.
  70. For any range, the character advance and offset can be customized by appending three space-separated integer values (additional advance, x offset, y offset) to the end. For example ``'a'-'b' 4 5 2`` sets the advance to ``char_width + 4`` and offset to ``Vector2(5, 2)`` for both `a` and `b` characters.
  71. 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.
  72. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedStringArray<class_PackedStringArray>` for more details.
  73. .. rst-class:: classref-item-separator
  74. ----
  75. .. _class_ResourceImporterImageFont_property_columns:
  76. .. rst-class:: classref-property
  77. :ref:`int<class_int>` **columns** = ``1`` :ref:`🔗<class_ResourceImporterImageFont_property_columns>`
  78. Number of columns in the font image. See also :ref:`rows<class_ResourceImporterImageFont_property_rows>`.
  79. .. rst-class:: classref-item-separator
  80. ----
  81. .. _class_ResourceImporterImageFont_property_compress:
  82. .. rst-class:: classref-property
  83. :ref:`bool<class_bool>` **compress** = ``true`` :ref:`🔗<class_ResourceImporterImageFont_property_compress>`
  84. If ``true``, uses lossless compression for the resulting font.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_ResourceImporterImageFont_property_descent:
  88. .. rst-class:: classref-property
  89. :ref:`int<class_int>` **descent** = ``0`` :ref:`🔗<class_ResourceImporterImageFont_property_descent>`
  90. Font descent (number of pixels below the baseline). If set to ``0``, half of the character height is used.
  91. .. rst-class:: classref-item-separator
  92. ----
  93. .. _class_ResourceImporterImageFont_property_fallbacks:
  94. .. rst-class:: classref-property
  95. :ref:`Array<class_Array>` **fallbacks** = ``[]`` :ref:`🔗<class_ResourceImporterImageFont_property_fallbacks>`
  96. 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.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_ResourceImporterImageFont_property_image_margin:
  100. .. rst-class:: classref-property
  101. :ref:`Rect2i<class_Rect2i>` **image_margin** = ``Rect2i(0, 0, 0, 0)`` :ref:`🔗<class_ResourceImporterImageFont_property_image_margin>`
  102. 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.
  103. .. rst-class:: classref-item-separator
  104. ----
  105. .. _class_ResourceImporterImageFont_property_kerning_pairs:
  106. .. rst-class:: classref-property
  107. :ref:`PackedStringArray<class_PackedStringArray>` **kerning_pairs** = ``PackedStringArray()`` :ref:`🔗<class_ResourceImporterImageFont_property_kerning_pairs>`
  108. Kerning pairs for the font. Kerning pair adjust the spacing between two characters.
  109. Each string consist of three space separated values: "from" string, "to" string and integer offset. Each combination form the two string for a kerning pair, e.g, ``ab cd -3`` will create kerning pairs ``ac``, ``ad``, ``bc``, and ``bd`` with offset ``-3``. ``\uXXXX`` escape sequences can be used to add Unicode characters.
  110. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedStringArray<class_PackedStringArray>` for more details.
  111. .. rst-class:: classref-item-separator
  112. ----
  113. .. _class_ResourceImporterImageFont_property_rows:
  114. .. rst-class:: classref-property
  115. :ref:`int<class_int>` **rows** = ``1`` :ref:`🔗<class_ResourceImporterImageFont_property_rows>`
  116. Number of rows in the font image. See also :ref:`columns<class_ResourceImporterImageFont_property_columns>`.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _class_ResourceImporterImageFont_property_scaling_mode:
  120. .. rst-class:: classref-property
  121. :ref:`int<class_int>` **scaling_mode** = ``2`` :ref:`🔗<class_ResourceImporterImageFont_property_scaling_mode>`
  122. Font scaling mode.
  123. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  124. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  125. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  126. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  127. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  128. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  129. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  130. .. |void| replace:: :abbr:`void (No return value.)`