TextLine.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TextLine" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Holds a line of text.
  5. </brief_description>
  6. <description>
  7. Abstraction over [TextServer] for handling a single line of text.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="add_object">
  13. <return type="bool" />
  14. <param index="0" name="key" type="Variant" />
  15. <param index="1" name="size" type="Vector2" />
  16. <param index="2" name="inline_align" type="int" enum="InlineAlignment" default="5" />
  17. <param index="3" name="length" type="int" default="1" />
  18. <param index="4" name="baseline" type="float" default="0.0" />
  19. <description>
  20. Adds inline object to the text buffer, [param key] must be unique. In the text, object is represented as [param length] object replacement characters.
  21. </description>
  22. </method>
  23. <method name="add_string">
  24. <return type="bool" />
  25. <param index="0" name="text" type="String" />
  26. <param index="1" name="font" type="Font" />
  27. <param index="2" name="font_size" type="int" />
  28. <param index="3" name="language" type="String" default="&quot;&quot;" />
  29. <param index="4" name="meta" type="Variant" default="null" />
  30. <description>
  31. Adds text span and font to draw it.
  32. </description>
  33. </method>
  34. <method name="clear">
  35. <return type="void" />
  36. <description>
  37. Clears text line (removes text and inline objects).
  38. </description>
  39. </method>
  40. <method name="draw" qualifiers="const">
  41. <return type="void" />
  42. <param index="0" name="canvas" type="RID" />
  43. <param index="1" name="pos" type="Vector2" />
  44. <param index="2" name="color" type="Color" default="Color(1, 1, 1, 1)" />
  45. <description>
  46. Draw text into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.
  47. </description>
  48. </method>
  49. <method name="draw_outline" qualifiers="const">
  50. <return type="void" />
  51. <param index="0" name="canvas" type="RID" />
  52. <param index="1" name="pos" type="Vector2" />
  53. <param index="2" name="outline_size" type="int" default="1" />
  54. <param index="3" name="color" type="Color" default="Color(1, 1, 1, 1)" />
  55. <description>
  56. Draw text into a canvas item at a given position, with [param color]. [param pos] specifies the top left corner of the bounding box.
  57. </description>
  58. </method>
  59. <method name="get_inferred_direction" qualifiers="const">
  60. <return type="int" enum="TextServer.Direction" />
  61. <description>
  62. Returns the text writing direction inferred by the BiDi algorithm.
  63. </description>
  64. </method>
  65. <method name="get_line_ascent" qualifiers="const">
  66. <return type="float" />
  67. <description>
  68. Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
  69. </description>
  70. </method>
  71. <method name="get_line_descent" qualifiers="const">
  72. <return type="float" />
  73. <description>
  74. Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
  75. </description>
  76. </method>
  77. <method name="get_line_underline_position" qualifiers="const">
  78. <return type="float" />
  79. <description>
  80. Returns pixel offset of the underline below the baseline.
  81. </description>
  82. </method>
  83. <method name="get_line_underline_thickness" qualifiers="const">
  84. <return type="float" />
  85. <description>
  86. Returns thickness of the underline.
  87. </description>
  88. </method>
  89. <method name="get_line_width" qualifiers="const">
  90. <return type="float" />
  91. <description>
  92. Returns width (for horizontal layout) or height (for vertical) of the text.
  93. </description>
  94. </method>
  95. <method name="get_object_rect" qualifiers="const">
  96. <return type="Rect2" />
  97. <param index="0" name="key" type="Variant" />
  98. <description>
  99. Returns bounding rectangle of the inline object.
  100. </description>
  101. </method>
  102. <method name="get_objects" qualifiers="const">
  103. <return type="Array" />
  104. <description>
  105. Returns array of inline objects.
  106. </description>
  107. </method>
  108. <method name="get_rid" qualifiers="const">
  109. <return type="RID" />
  110. <description>
  111. Returns TextServer buffer RID.
  112. </description>
  113. </method>
  114. <method name="get_size" qualifiers="const">
  115. <return type="Vector2" />
  116. <description>
  117. Returns size of the bounding box of the text.
  118. </description>
  119. </method>
  120. <method name="hit_test" qualifiers="const">
  121. <return type="int" />
  122. <param index="0" name="coords" type="float" />
  123. <description>
  124. Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
  125. </description>
  126. </method>
  127. <method name="resize_object">
  128. <return type="bool" />
  129. <param index="0" name="key" type="Variant" />
  130. <param index="1" name="size" type="Vector2" />
  131. <param index="2" name="inline_align" type="int" enum="InlineAlignment" default="5" />
  132. <param index="3" name="baseline" type="float" default="0.0" />
  133. <description>
  134. Sets new size and alignment of embedded object.
  135. </description>
  136. </method>
  137. <method name="set_bidi_override">
  138. <return type="void" />
  139. <param index="0" name="override" type="Array" />
  140. <description>
  141. Overrides BiDi for the structured text.
  142. Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.
  143. </description>
  144. </method>
  145. <method name="tab_align">
  146. <return type="void" />
  147. <param index="0" name="tab_stops" type="PackedFloat32Array" />
  148. <description>
  149. Aligns text to the given tab-stops.
  150. </description>
  151. </method>
  152. </methods>
  153. <members>
  154. <member name="alignment" type="int" setter="set_horizontal_alignment" getter="get_horizontal_alignment" enum="HorizontalAlignment" default="0">
  155. Sets text alignment within the line as if the line was horizontal.
  156. </member>
  157. <member name="direction" type="int" setter="set_direction" getter="get_direction" enum="TextServer.Direction" default="0">
  158. Text writing direction.
  159. </member>
  160. <member name="ellipsis_char" type="String" setter="set_ellipsis_char" getter="get_ellipsis_char" default="&quot;…&quot;">
  161. Ellipsis character used for text clipping.
  162. </member>
  163. <member name="flags" type="int" setter="set_flags" getter="get_flags" enum="TextServer.JustificationFlag" is_bitfield="true" default="3">
  164. Line alignment rules. For more info see [TextServer].
  165. </member>
  166. <member name="orientation" type="int" setter="set_orientation" getter="get_orientation" enum="TextServer.Orientation" default="0">
  167. Text orientation.
  168. </member>
  169. <member name="preserve_control" type="bool" setter="set_preserve_control" getter="get_preserve_control" default="false">
  170. If set to [code]true[/code] text will display control characters.
  171. </member>
  172. <member name="preserve_invalid" type="bool" setter="set_preserve_invalid" getter="get_preserve_invalid" default="true">
  173. If set to [code]true[/code] text will display invalid characters.
  174. </member>
  175. <member name="text_overrun_behavior" type="int" setter="set_text_overrun_behavior" getter="get_text_overrun_behavior" enum="TextServer.OverrunBehavior" default="3">
  176. Sets the clipping behavior when the text exceeds the text line's set width. See [enum TextServer.OverrunBehavior] for a description of all modes.
  177. </member>
  178. <member name="width" type="float" setter="set_width" getter="get_width" default="-1.0">
  179. Text line width.
  180. </member>
  181. </members>
  182. </class>