TextLine.xml 6.8 KB

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