123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ResourceImporterImageFont.xml.
- .. _class_ResourceImporterImageFont:
- ResourceImporterImageFont
- =========================
- **Inherits:** :ref:`ResourceImporter<class_ResourceImporter>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- Imports a bitmap font where all glyphs have the same width and height.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- 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.
- See also :ref:`ResourceImporterDynamicFont<class_ResourceImporterDynamicFont>`.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - `Bitmap fonts - Using fonts <../tutorials/ui/gui_using_fonts.html#bitmap-fonts>`__
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`int<class_int>` | :ref:`ascent<class_ResourceImporterImageFont_property_ascent>` | ``0`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`Rect2i<class_Rect2i>` | :ref:`character_margin<class_ResourceImporterImageFont_property_character_margin>` | ``Rect2i(0, 0, 0, 0)`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`character_ranges<class_ResourceImporterImageFont_property_character_ranges>` | ``PackedStringArray()`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`int<class_int>` | :ref:`columns<class_ResourceImporterImageFont_property_columns>` | ``1`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`bool<class_bool>` | :ref:`compress<class_ResourceImporterImageFont_property_compress>` | ``true`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`int<class_int>` | :ref:`descent<class_ResourceImporterImageFont_property_descent>` | ``0`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`Array<class_Array>` | :ref:`fallbacks<class_ResourceImporterImageFont_property_fallbacks>` | ``[]`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`Rect2i<class_Rect2i>` | :ref:`image_margin<class_ResourceImporterImageFont_property_image_margin>` | ``Rect2i(0, 0, 0, 0)`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`kerning_pairs<class_ResourceImporterImageFont_property_kerning_pairs>` | ``PackedStringArray()`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`int<class_int>` | :ref:`rows<class_ResourceImporterImageFont_property_rows>` | ``1`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- | :ref:`int<class_int>` | :ref:`scaling_mode<class_ResourceImporterImageFont_property_scaling_mode>` | ``2`` |
- +---------------------------------------------------+------------------------------------------------------------------------------------+-------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_ResourceImporterImageFont_property_ascent:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **ascent** = ``0`` :ref:`🔗<class_ResourceImporterImageFont_property_ascent>`
- Font ascent (number of pixels above the baseline). If set to ``0``, half of the character height is used.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_character_margin:
- .. rst-class:: classref-property
- :ref:`Rect2i<class_Rect2i>` **character_margin** = ``Rect2i(0, 0, 0, 0)`` :ref:`🔗<class_ResourceImporterImageFont_property_character_margin>`
- 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>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_character_ranges:
- .. rst-class:: classref-property
- :ref:`PackedStringArray<class_PackedStringArray>` **character_ranges** = ``PackedStringArray()`` :ref:`🔗<class_ResourceImporterImageFont_property_character_ranges>`
- 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.
- 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.
- 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.
- 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.
- **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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_columns:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **columns** = ``1`` :ref:`🔗<class_ResourceImporterImageFont_property_columns>`
- Number of columns in the font image. See also :ref:`rows<class_ResourceImporterImageFont_property_rows>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_compress:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **compress** = ``true`` :ref:`🔗<class_ResourceImporterImageFont_property_compress>`
- If ``true``, uses lossless compression for the resulting font.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_descent:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **descent** = ``0`` :ref:`🔗<class_ResourceImporterImageFont_property_descent>`
- Font descent (number of pixels below the baseline). If set to ``0``, half of the character height is used.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_fallbacks:
- .. rst-class:: classref-property
- :ref:`Array<class_Array>` **fallbacks** = ``[]`` :ref:`🔗<class_ResourceImporterImageFont_property_fallbacks>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_image_margin:
- .. rst-class:: classref-property
- :ref:`Rect2i<class_Rect2i>` **image_margin** = ``Rect2i(0, 0, 0, 0)`` :ref:`🔗<class_ResourceImporterImageFont_property_image_margin>`
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_kerning_pairs:
- .. rst-class:: classref-property
- :ref:`PackedStringArray<class_PackedStringArray>` **kerning_pairs** = ``PackedStringArray()`` :ref:`🔗<class_ResourceImporterImageFont_property_kerning_pairs>`
- Kerning pairs for the font. Kerning pair adjust the spacing between two characters.
- 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.
- **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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_rows:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **rows** = ``1`` :ref:`🔗<class_ResourceImporterImageFont_property_rows>`
- Number of rows in the font image. See also :ref:`columns<class_ResourceImporterImageFont_property_columns>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_ResourceImporterImageFont_property_scaling_mode:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **scaling_mode** = ``2`` :ref:`🔗<class_ResourceImporterImageFont_property_scaling_mode>`
- Font scaling mode.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|