Files
godot-docs/classes/class_textmesh.rst
T

270 lines
13 KiB
ReStructuredText

: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/TextMesh.xml.
.. _class_TextMesh:
TextMesh
========
**Inherits:** :ref:`PrimitiveMesh<class_PrimitiveMesh>` **<** :ref:`Mesh<class_Mesh>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Generate an :ref:`PrimitiveMesh<class_PrimitiveMesh>` from the text.
Description
-----------
Generate an :ref:`PrimitiveMesh<class_PrimitiveMesh>` from the text.
TextMesh can be generated only when using dynamic fonts with vector glyph contours. Bitmap fonts (including bitmap data in the TrueType/OpenType containers, like color emoji fonts) are not supported.
The UV layout is arranged in 4 horizontal strips, top to bottom: 40% of the height for the front face, 40% for the back face, 10% for the outer edges and 10% for the inner edges.
Properties
----------
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`curve_step<class_TextMesh_property_curve_step>` | ``0.5`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`depth<class_TextMesh_property_depth>` | ``0.05`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`Font<class_Font>` | :ref:`font<class_TextMesh_property_font>` | |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`int<class_int>` | :ref:`font_size<class_TextMesh_property_font_size>` | ``16`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`horizontal_alignment<class_TextMesh_property_horizontal_alignment>` | ``1`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`String<class_String>` | :ref:`language<class_TextMesh_property_language>` | ``""`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`pixel_size<class_TextMesh_property_pixel_size>` | ``0.01`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` | :ref:`structured_text_bidi_override<class_TextMesh_property_structured_text_bidi_override>` | ``0`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`Array<class_Array>` | :ref:`structured_text_bidi_override_options<class_TextMesh_property_structured_text_bidi_override_options>` | ``[]`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`String<class_String>` | :ref:`text<class_TextMesh_property_text>` | ``""`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`Direction<enum_TextServer_Direction>` | :ref:`text_direction<class_TextMesh_property_text_direction>` | ``0`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`uppercase<class_TextMesh_property_uppercase>` | ``false`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`width<class_TextMesh_property_width>` | ``500.0`` |
+-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-----------+
Property Descriptions
---------------------
.. _class_TextMesh_property_curve_step:
- :ref:`float<class_float>` **curve_step**
+-----------+-----------------------+
| *Default* | ``0.5`` |
+-----------+-----------------------+
| *Setter* | set_curve_step(value) |
+-----------+-----------------------+
| *Getter* | get_curve_step() |
+-----------+-----------------------+
Step (in pixels) used to approximate Bézier curves.
----
.. _class_TextMesh_property_depth:
- :ref:`float<class_float>` **depth**
+-----------+------------------+
| *Default* | ``0.05`` |
+-----------+------------------+
| *Setter* | set_depth(value) |
+-----------+------------------+
| *Getter* | get_depth() |
+-----------+------------------+
Depths of the mesh, if set to ``0.0`` only front surface, is generated, and UV layout is changed to use full texture for the front face only.
----
.. _class_TextMesh_property_font:
- :ref:`Font<class_Font>` **font**
+----------+-----------------+
| *Setter* | set_font(value) |
+----------+-----------------+
| *Getter* | get_font() |
+----------+-----------------+
Font configuration used to display text.
----
.. _class_TextMesh_property_font_size:
- :ref:`int<class_int>` **font_size**
+-----------+----------------------+
| *Default* | ``16`` |
+-----------+----------------------+
| *Setter* | set_font_size(value) |
+-----------+----------------------+
| *Getter* | get_font_size() |
+-----------+----------------------+
Font size of the ``TextMesh``'s text.
----
.. _class_TextMesh_property_horizontal_alignment:
- :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **horizontal_alignment**
+-----------+---------------------------------+
| *Default* | ``1`` |
+-----------+---------------------------------+
| *Setter* | set_horizontal_alignment(value) |
+-----------+---------------------------------+
| *Getter* | get_horizontal_alignment() |
+-----------+---------------------------------+
Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` constants.
----
.. _class_TextMesh_property_language:
- :ref:`String<class_String>` **language**
+-----------+---------------------+
| *Default* | ``""`` |
+-----------+---------------------+
| *Setter* | set_language(value) |
+-----------+---------------------+
| *Getter* | get_language() |
+-----------+---------------------+
Language code used for text shaping algorithms, if left empty current locale is used instead.
----
.. _class_TextMesh_property_pixel_size:
- :ref:`float<class_float>` **pixel_size**
+-----------+-----------------------+
| *Default* | ``0.01`` |
+-----------+-----------------------+
| *Setter* | set_pixel_size(value) |
+-----------+-----------------------+
| *Getter* | get_pixel_size() |
+-----------+-----------------------+
The size of one pixel's width on the text to scale it in 3D.
----
.. _class_TextMesh_property_structured_text_bidi_override:
- :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **structured_text_bidi_override**
+-----------+------------------------------------------+
| *Default* | ``0`` |
+-----------+------------------------------------------+
| *Setter* | set_structured_text_bidi_override(value) |
+-----------+------------------------------------------+
| *Getter* | get_structured_text_bidi_override() |
+-----------+------------------------------------------+
Set BiDi algorithm override for the structured text.
----
.. _class_TextMesh_property_structured_text_bidi_override_options:
- :ref:`Array<class_Array>` **structured_text_bidi_override_options**
+-----------+--------------------------------------------------+
| *Default* | ``[]`` |
+-----------+--------------------------------------------------+
| *Setter* | set_structured_text_bidi_override_options(value) |
+-----------+--------------------------------------------------+
| *Getter* | get_structured_text_bidi_override_options() |
+-----------+--------------------------------------------------+
Set additional options for BiDi override.
----
.. _class_TextMesh_property_text:
- :ref:`String<class_String>` **text**
+-----------+-----------------+
| *Default* | ``""`` |
+-----------+-----------------+
| *Setter* | set_text(value) |
+-----------+-----------------+
| *Getter* | get_text() |
+-----------+-----------------+
The text to generate mesh from.
----
.. _class_TextMesh_property_text_direction:
- :ref:`Direction<enum_TextServer_Direction>` **text_direction**
+-----------+---------------------------+
| *Default* | ``0`` |
+-----------+---------------------------+
| *Setter* | set_text_direction(value) |
+-----------+---------------------------+
| *Getter* | get_text_direction() |
+-----------+---------------------------+
Base text writing direction.
----
.. _class_TextMesh_property_uppercase:
- :ref:`bool<class_bool>` **uppercase**
+-----------+----------------------+
| *Default* | ``false`` |
+-----------+----------------------+
| *Setter* | set_uppercase(value) |
+-----------+----------------------+
| *Getter* | is_uppercase() |
+-----------+----------------------+
If ``true``, all the text displays as UPPERCASE.
----
.. _class_TextMesh_property_width:
- :ref:`float<class_float>` **width**
+-----------+------------------+
| *Default* | ``500.0`` |
+-----------+------------------+
| *Setter* | set_width(value) |
+-----------+------------------+
| *Getter* | get_width() |
+-----------+------------------+
Text width (in pixels), used for fill alignment.
.. |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.)`