TextServer.xml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TextServer" inherits="Object" version="4.0">
  3. <brief_description>
  4. Interface for the fonts and complex text layouts.
  5. </brief_description>
  6. <description>
  7. [TextServer] is the API backend for managing fonts, and rendering complex text.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="create_font_memory">
  13. <return type="RID">
  14. </return>
  15. <argument index="0" name="data" type="PackedByteArray">
  16. </argument>
  17. <argument index="1" name="type" type="String">
  18. </argument>
  19. <argument index="2" name="base_size" type="int" default="16">
  20. </argument>
  21. <description>
  22. Creates new font from the data in memory. To free the resulting font, use [method free_rid] method.
  23. Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method font_get_base_size] to check actual font size.
  24. </description>
  25. </method>
  26. <method name="create_font_resource">
  27. <return type="RID">
  28. </return>
  29. <argument index="0" name="filename" type="String">
  30. </argument>
  31. <argument index="1" name="base_size" type="int" default="16">
  32. </argument>
  33. <description>
  34. Creates new font from the file. To free the resulting font, use [method free_rid] method.
  35. Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method font_get_base_size] to check actual font size.
  36. </description>
  37. </method>
  38. <method name="create_font_system">
  39. <return type="RID">
  40. </return>
  41. <argument index="0" name="name" type="String">
  42. </argument>
  43. <argument index="1" name="base_size" type="int" default="16">
  44. </argument>
  45. <description>
  46. Creates new font from the system font. To free the resulting font, use [method free_rid] method.
  47. Note: This method is supported by servers with the [code]FEATURE_FONT_SYSTEM[/code] feature.
  48. Note: For non-scalable fonts [code]base_size[/code] is ignored, use [method font_get_base_size] to check actual font size.
  49. </description>
  50. </method>
  51. <method name="create_shaped_text">
  52. <return type="RID">
  53. </return>
  54. <argument index="0" name="direction" type="int" enum="TextServer.Direction" default="0">
  55. </argument>
  56. <argument index="1" name="orientation" type="int" enum="TextServer.Orientation" default="0">
  57. </argument>
  58. <description>
  59. Creates new buffer for complex text layout, with the given [code]direction[/code] and [code]orientation[/code]. To free the resulting buffer, use [method free_rid] method.
  60. Note: Direction is ignored if server does not support [code]FEATURE_BIDI_LAYOUT[/code] feature.
  61. Note: Orientation is ignored if server does not support [code]FEATURE_VERTICAL_LAYOUT[/code] feature.
  62. </description>
  63. </method>
  64. <method name="draw_hex_code_box" qualifiers="const">
  65. <return type="void">
  66. </return>
  67. <argument index="0" name="canvas" type="RID">
  68. </argument>
  69. <argument index="1" name="size" type="int">
  70. </argument>
  71. <argument index="2" name="pos" type="Vector2">
  72. </argument>
  73. <argument index="3" name="index" type="int">
  74. </argument>
  75. <argument index="4" name="color" type="Color">
  76. </argument>
  77. <description>
  78. Draws box displaying character hexadecimal code. Used for replacing missing characters.
  79. </description>
  80. </method>
  81. <method name="font_draw_glyph" qualifiers="const">
  82. <return type="Vector2">
  83. </return>
  84. <argument index="0" name="font" type="RID">
  85. </argument>
  86. <argument index="1" name="canvas" type="RID">
  87. </argument>
  88. <argument index="2" name="size" type="int">
  89. </argument>
  90. <argument index="3" name="pos" type="Vector2">
  91. </argument>
  92. <argument index="4" name="index" type="int">
  93. </argument>
  94. <argument index="5" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
  95. </argument>
  96. <description>
  97. Draws single glyph into a canvas item at the position, using [code]font[/code] at the size [code]size[/code].
  98. Note: Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index].
  99. </description>
  100. </method>
  101. <method name="font_draw_glyph_outline" qualifiers="const">
  102. <return type="Vector2">
  103. </return>
  104. <argument index="0" name="font" type="RID">
  105. </argument>
  106. <argument index="1" name="canvas" type="RID">
  107. </argument>
  108. <argument index="2" name="size" type="int">
  109. </argument>
  110. <argument index="3" name="outline_size" type="int">
  111. </argument>
  112. <argument index="4" name="pos" type="Vector2">
  113. </argument>
  114. <argument index="5" name="index" type="int">
  115. </argument>
  116. <argument index="6" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
  117. </argument>
  118. <description>
  119. Draws single glyph outline of size [code]outline_size[/code] into a canvas item at the position, using [code]font[/code] at the size [code]size[/code].
  120. Note: Glyph index is specific to the font, use glyphs indices returned by [method shaped_text_get_glyphs] or [method font_get_glyph_index].
  121. </description>
  122. </method>
  123. <method name="font_get_antialiased" qualifiers="const">
  124. <return type="bool">
  125. </return>
  126. <argument index="0" name="font" type="RID">
  127. </argument>
  128. <description>
  129. Returns [code]true[/code], if font anti-aliasing is supported and enabled.
  130. </description>
  131. </method>
  132. <method name="font_get_ascent" qualifiers="const">
  133. <return type="float">
  134. </return>
  135. <argument index="0" name="font" type="RID">
  136. </argument>
  137. <argument index="1" name="size" type="int">
  138. </argument>
  139. <description>
  140. Returns the font ascent (number of pixels above the baseline).
  141. </description>
  142. </method>
  143. <method name="font_get_base_size" qualifiers="const">
  144. <return type="float">
  145. </return>
  146. <argument index="0" name="font" type="RID">
  147. </argument>
  148. <description>
  149. Returns the default size of the font.
  150. </description>
  151. </method>
  152. <method name="font_get_descent" qualifiers="const">
  153. <return type="float">
  154. </return>
  155. <argument index="0" name="font" type="RID">
  156. </argument>
  157. <argument index="1" name="size" type="int">
  158. </argument>
  159. <description>
  160. Returns the font descent (number of pixels below the baseline).
  161. </description>
  162. </method>
  163. <method name="font_get_distance_field_hint" qualifiers="const">
  164. <return type="bool">
  165. </return>
  166. <argument index="0" name="font" type="RID">
  167. </argument>
  168. <description>
  169. Returns [code]true[/code], if distance field hint is enabled.
  170. </description>
  171. </method>
  172. <method name="font_get_feature_list" qualifiers="const">
  173. <return type="Dictionary">
  174. </return>
  175. <argument index="0" name="font" type="RID">
  176. </argument>
  177. <description>
  178. Returns list of OpenType features supported by font.
  179. </description>
  180. </method>
  181. <method name="font_get_force_autohinter" qualifiers="const">
  182. <return type="bool">
  183. </return>
  184. <argument index="0" name="font" type="RID">
  185. </argument>
  186. <description>
  187. Returns [code]true[/code], if autohinter is supported and enabled.
  188. </description>
  189. </method>
  190. <method name="font_get_glyph_advance" qualifiers="const">
  191. <return type="Vector2">
  192. </return>
  193. <argument index="0" name="font" type="RID">
  194. </argument>
  195. <argument index="1" name="index" type="int">
  196. </argument>
  197. <argument index="2" name="size" type="int">
  198. </argument>
  199. <description>
  200. Returns advance of the glyph.
  201. </description>
  202. </method>
  203. <method name="font_get_glyph_index" qualifiers="const">
  204. <return type="int">
  205. </return>
  206. <argument index="0" name="font" type="RID">
  207. </argument>
  208. <argument index="1" name="char" type="int">
  209. </argument>
  210. <argument index="2" name="variation_selector" type="int" default="0">
  211. </argument>
  212. <description>
  213. Returns the glyph index of a [code]char[/code], optionally modified by the [code]variation_selector[/code].
  214. </description>
  215. </method>
  216. <method name="font_get_glyph_kerning" qualifiers="const">
  217. <return type="Vector2">
  218. </return>
  219. <argument index="0" name="font" type="RID">
  220. </argument>
  221. <argument index="1" name="index_a" type="int">
  222. </argument>
  223. <argument index="2" name="index_b" type="int">
  224. </argument>
  225. <argument index="3" name="size" type="int">
  226. </argument>
  227. <description>
  228. Returns a kerning of the pair of glyphs.
  229. </description>
  230. </method>
  231. <method name="font_get_height" qualifiers="const">
  232. <return type="float">
  233. </return>
  234. <argument index="0" name="font" type="RID">
  235. </argument>
  236. <argument index="1" name="size" type="int">
  237. </argument>
  238. <description>
  239. Returns the total font height (ascent plus descent) in pixels.
  240. </description>
  241. </method>
  242. <method name="font_get_hinting" qualifiers="const">
  243. <return type="int" enum="TextServer.Hinting">
  244. </return>
  245. <argument index="0" name="font" type="RID">
  246. </argument>
  247. <description>
  248. Returns the font hinting.
  249. </description>
  250. </method>
  251. <method name="font_get_language_support_override">
  252. <return type="bool">
  253. </return>
  254. <argument index="0" name="font" type="RID">
  255. </argument>
  256. <argument index="1" name="language" type="String">
  257. </argument>
  258. <description>
  259. Returns [code]true[/code] if support override is enabled for the [code]language[/code].
  260. </description>
  261. </method>
  262. <method name="font_get_language_support_overrides">
  263. <return type="PackedStringArray">
  264. </return>
  265. <argument index="0" name="font" type="RID">
  266. </argument>
  267. <description>
  268. Returns list of language support overrides.
  269. </description>
  270. </method>
  271. <method name="font_get_oversampling" qualifiers="const">
  272. <return type="float">
  273. </return>
  274. <description>
  275. Returns the font oversampling factor, shared by all fonts in the TextServer.
  276. </description>
  277. </method>
  278. <method name="font_get_script_support_override">
  279. <return type="bool">
  280. </return>
  281. <argument index="0" name="font" type="RID">
  282. </argument>
  283. <argument index="1" name="script" type="String">
  284. </argument>
  285. <description>
  286. Returns [code]true[/code] if support override is enabled for the [code]script[/code].
  287. </description>
  288. </method>
  289. <method name="font_get_script_support_overrides">
  290. <return type="PackedStringArray">
  291. </return>
  292. <argument index="0" name="font" type="RID">
  293. </argument>
  294. <description>
  295. Returns list of script support overrides.
  296. </description>
  297. </method>
  298. <method name="font_get_supported_chars" qualifiers="const">
  299. <return type="String">
  300. </return>
  301. <argument index="0" name="font" type="RID">
  302. </argument>
  303. <description>
  304. Returns a string containing all the characters available in the font.
  305. </description>
  306. </method>
  307. <method name="font_get_underline_position" qualifiers="const">
  308. <return type="float">
  309. </return>
  310. <argument index="0" name="font" type="RID">
  311. </argument>
  312. <argument index="1" name="size" type="int">
  313. </argument>
  314. <description>
  315. Returns underline offset (number of pixels below the baseline).
  316. </description>
  317. </method>
  318. <method name="font_get_underline_thickness" qualifiers="const">
  319. <return type="float">
  320. </return>
  321. <argument index="0" name="font" type="RID">
  322. </argument>
  323. <argument index="1" name="size" type="int">
  324. </argument>
  325. <description>
  326. Returns underline thickness in pixels.
  327. </description>
  328. </method>
  329. <method name="font_has_char" qualifiers="const">
  330. <return type="bool">
  331. </return>
  332. <argument index="0" name="font" type="RID">
  333. </argument>
  334. <argument index="1" name="char" type="int">
  335. </argument>
  336. <description>
  337. Returns [code]true[/code] if [code]char[/code] is available in the font.
  338. </description>
  339. </method>
  340. <method name="font_has_outline" qualifiers="const">
  341. <return type="bool">
  342. </return>
  343. <argument index="0" name="font" type="RID">
  344. </argument>
  345. <description>
  346. Returns [code]true[/code], if font supports glyph outlines.
  347. </description>
  348. </method>
  349. <method name="font_is_language_supported" qualifiers="const">
  350. <return type="bool">
  351. </return>
  352. <argument index="0" name="font" type="RID">
  353. </argument>
  354. <argument index="1" name="language" type="String">
  355. </argument>
  356. <description>
  357. Returns [code]true[/code], if font supports given language (ISO 639 code).
  358. </description>
  359. </method>
  360. <method name="font_is_script_supported" qualifiers="const">
  361. <return type="bool">
  362. </return>
  363. <argument index="0" name="font" type="RID">
  364. </argument>
  365. <argument index="1" name="script" type="String">
  366. </argument>
  367. <description>
  368. Returns [code]true[/code], if font supports given script (ISO 15924 code).
  369. </description>
  370. </method>
  371. <method name="font_remove_language_support_override">
  372. <return type="void">
  373. </return>
  374. <argument index="0" name="font" type="RID">
  375. </argument>
  376. <argument index="1" name="language" type="String">
  377. </argument>
  378. <description>
  379. Remove language support override.
  380. </description>
  381. </method>
  382. <method name="font_remove_script_support_override">
  383. <return type="void">
  384. </return>
  385. <argument index="0" name="font" type="RID">
  386. </argument>
  387. <argument index="1" name="script" type="String">
  388. </argument>
  389. <description>
  390. Removes script support override.
  391. </description>
  392. </method>
  393. <method name="font_set_antialiased">
  394. <return type="void">
  395. </return>
  396. <argument index="0" name="font" type="RID">
  397. </argument>
  398. <argument index="1" name="antialiased" type="bool">
  399. </argument>
  400. <description>
  401. Sets font anti-aliasing.
  402. </description>
  403. </method>
  404. <method name="font_set_distance_field_hint">
  405. <return type="void">
  406. </return>
  407. <argument index="0" name="font" type="RID">
  408. </argument>
  409. <argument index="1" name="distance_field" type="bool">
  410. </argument>
  411. <description>
  412. Sets font distance field hint.
  413. </description>
  414. </method>
  415. <method name="font_set_force_autohinter">
  416. <return type="void">
  417. </return>
  418. <argument index="0" name="font" type="RID">
  419. </argument>
  420. <argument index="1" name="enabeld" type="bool">
  421. </argument>
  422. <description>
  423. Enables/disables default autohinter.
  424. </description>
  425. </method>
  426. <method name="font_set_hinting">
  427. <return type="void">
  428. </return>
  429. <argument index="0" name="font" type="RID">
  430. </argument>
  431. <argument index="1" name="hinting" type="int" enum="TextServer.Hinting">
  432. </argument>
  433. <description>
  434. Sets font hinting.
  435. </description>
  436. </method>
  437. <method name="font_set_language_support_override">
  438. <return type="void">
  439. </return>
  440. <argument index="0" name="font" type="RID">
  441. </argument>
  442. <argument index="1" name="language" type="String">
  443. </argument>
  444. <argument index="2" name="supported" type="bool">
  445. </argument>
  446. <description>
  447. Adds override for [method font_is_language_supported].
  448. </description>
  449. </method>
  450. <method name="font_set_oversampling">
  451. <return type="void">
  452. </return>
  453. <argument index="0" name="oversampling" type="float">
  454. </argument>
  455. <description>
  456. Sets oversampling factor, shared by all font in the TextServer.
  457. </description>
  458. </method>
  459. <method name="font_set_script_support_override">
  460. <return type="void">
  461. </return>
  462. <argument index="0" name="font" type="RID">
  463. </argument>
  464. <argument index="1" name="script" type="String">
  465. </argument>
  466. <argument index="2" name="supported" type="bool">
  467. </argument>
  468. <description>
  469. Adds override for [method font_is_script_supported].
  470. </description>
  471. </method>
  472. <method name="format_number" qualifiers="const">
  473. <return type="String">
  474. </return>
  475. <argument index="0" name="number" type="String">
  476. </argument>
  477. <argument index="1" name="language" type="String" default="&quot;&quot;">
  478. </argument>
  479. <description>
  480. Converts a number from the Western Arabic (0..9) to the numeral systems used in [code]language[/code].
  481. </description>
  482. </method>
  483. <method name="free_rid">
  484. <return type="void">
  485. </return>
  486. <argument index="0" name="rid" type="RID">
  487. </argument>
  488. <description>
  489. Frees an object created by this [TextServer].
  490. </description>
  491. </method>
  492. <method name="get_hex_code_box_size" qualifiers="const">
  493. <return type="Vector2">
  494. </return>
  495. <argument index="0" name="size" type="int">
  496. </argument>
  497. <argument index="1" name="index" type="int">
  498. </argument>
  499. <description>
  500. Returns size of the replacement character (box with character hexadecimal code that is drawn in place of invalid characters).
  501. </description>
  502. </method>
  503. <method name="get_name" qualifiers="const">
  504. <return type="String">
  505. </return>
  506. <description>
  507. Returns the name of the server interface.
  508. </description>
  509. </method>
  510. <method name="get_system_fonts" qualifiers="const">
  511. <return type="PackedStringArray">
  512. </return>
  513. <description>
  514. Returns list of available system fonts.
  515. Note: This method is supported by servers with the [code]FEATURE_FONT_SYSTEM[/code] feature.
  516. </description>
  517. </method>
  518. <method name="has">
  519. <return type="bool">
  520. </return>
  521. <argument index="0" name="rid" type="RID">
  522. </argument>
  523. <description>
  524. Returns [code]true[/code] if [code]rid[/code] is valid resource owned by this text server.
  525. </description>
  526. </method>
  527. <method name="has_feature">
  528. <return type="bool">
  529. </return>
  530. <argument index="0" name="feature" type="int" enum="TextServer.Feature">
  531. </argument>
  532. <description>
  533. Returns [code]true[/code] if the server supports a feature.
  534. </description>
  535. </method>
  536. <method name="is_locale_right_to_left">
  537. <return type="bool">
  538. </return>
  539. <argument index="0" name="locale" type="String">
  540. </argument>
  541. <description>
  542. Returns [code]true[/code] if locale is right-to-left.
  543. </description>
  544. </method>
  545. <method name="load_support_data">
  546. <return type="bool">
  547. </return>
  548. <argument index="0" name="filename" type="String">
  549. </argument>
  550. <description>
  551. Loads optional TextServer database (e.g. ICU break iterators and dictionaries).
  552. Note: This function should be called before any other TextServer functions used, otherwise it won't have any effect.
  553. </description>
  554. </method>
  555. <method name="name_to_tag">
  556. <return type="int">
  557. </return>
  558. <argument index="0" name="name" type="String">
  559. </argument>
  560. <description>
  561. Converts readable feature, variation, script or language name to OpenType tag.
  562. </description>
  563. </method>
  564. <method name="parse_number" qualifiers="const">
  565. <return type="String">
  566. </return>
  567. <argument index="0" name="number" type="String">
  568. </argument>
  569. <argument index="1" name="language" type="String" default="&quot;&quot;">
  570. </argument>
  571. <description>
  572. Converts a number from the numeral systems used in [code]language[/code] to Western Arabic (0..9).
  573. </description>
  574. </method>
  575. <method name="percent_sign" qualifiers="const">
  576. <return type="String">
  577. </return>
  578. <argument index="0" name="language" type="String" default="&quot;&quot;">
  579. </argument>
  580. <description>
  581. Returns percent sign used in the [code]language[/code].
  582. </description>
  583. </method>
  584. <method name="shaped_text_add_object">
  585. <return type="bool">
  586. </return>
  587. <argument index="0" name="shaped" type="RID">
  588. </argument>
  589. <argument index="1" name="key" type="Variant">
  590. </argument>
  591. <argument index="2" name="size" type="Vector2">
  592. </argument>
  593. <argument index="3" name="inline_align" type="int" enum="VAlign" default="1">
  594. </argument>
  595. <argument index="4" name="length" type="int" default="1">
  596. </argument>
  597. <description>
  598. Adds inline object to the text buffer, [code]key[/code] must be unique. In the text, object is represented as [code]length[/code] object replacement characters.
  599. </description>
  600. </method>
  601. <method name="shaped_text_add_string">
  602. <return type="bool">
  603. </return>
  604. <argument index="0" name="shaped" type="RID">
  605. </argument>
  606. <argument index="1" name="text" type="String">
  607. </argument>
  608. <argument index="2" name="fonts" type="Array">
  609. </argument>
  610. <argument index="3" name="size" type="int">
  611. </argument>
  612. <argument index="4" name="opentype_features" type="Dictionary" default="{
  613. }">
  614. </argument>
  615. <argument index="5" name="language" type="String" default="&quot;&quot;">
  616. </argument>
  617. <description>
  618. Adds text span and font to draw it to the text buffer.
  619. </description>
  620. </method>
  621. <method name="shaped_text_clear">
  622. <return type="void">
  623. </return>
  624. <argument index="0" name="arg0" type="RID">
  625. </argument>
  626. <description>
  627. Clears text buffer (removes text and inline objects).
  628. </description>
  629. </method>
  630. <method name="shaped_text_draw" qualifiers="const">
  631. <return type="void">
  632. </return>
  633. <argument index="0" name="shaped" type="RID">
  634. </argument>
  635. <argument index="1" name="canvas" type="RID">
  636. </argument>
  637. <argument index="2" name="pos" type="Vector2">
  638. </argument>
  639. <argument index="3" name="clip_l" type="float" default="-1">
  640. </argument>
  641. <argument index="4" name="clip_r" type="float" default="-1">
  642. </argument>
  643. <argument index="5" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
  644. </argument>
  645. <description>
  646. Draw shaped text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout).
  647. </description>
  648. </method>
  649. <method name="shaped_text_draw_outline" qualifiers="const">
  650. <return type="void">
  651. </return>
  652. <argument index="0" name="shaped" type="RID">
  653. </argument>
  654. <argument index="1" name="canvas" type="RID">
  655. </argument>
  656. <argument index="2" name="pos" type="Vector2">
  657. </argument>
  658. <argument index="3" name="clip_l" type="float" default="-1">
  659. </argument>
  660. <argument index="4" name="clip_r" type="float" default="-1">
  661. </argument>
  662. <argument index="5" name="outline_size" type="int" default="1">
  663. </argument>
  664. <argument index="6" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
  665. </argument>
  666. <description>
  667. Draw the outline of the shaped text into a canvas item at a given position, with [code]color[/code]. [code]pos[/code] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout).
  668. </description>
  669. </method>
  670. <method name="shaped_text_fit_to_width">
  671. <return type="float">
  672. </return>
  673. <argument index="0" name="shaped" type="RID">
  674. </argument>
  675. <argument index="1" name="width" type="float">
  676. </argument>
  677. <argument index="2" name="jst_flags" type="int" default="3">
  678. </argument>
  679. <description>
  680. Adjusts text with to fit to specified width, returns new text width.
  681. </description>
  682. </method>
  683. <method name="shaped_text_get_ascent" qualifiers="const">
  684. <return type="float">
  685. </return>
  686. <argument index="0" name="shaped" type="RID">
  687. </argument>
  688. <description>
  689. Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
  690. Note: overall ascent can be higher than font ascent, if some glyphs are displaced from the baseline.
  691. </description>
  692. </method>
  693. <method name="shaped_text_get_carets" qualifiers="const">
  694. <return type="Dictionary">
  695. </return>
  696. <argument index="0" name="shaped" type="RID">
  697. </argument>
  698. <argument index="1" name="position" type="int">
  699. </argument>
  700. <description>
  701. Returns shapes of the carets corresponding to the character offset [code]position[/code] in the text. Returned caret shape is 1 pixel wide rectangle.
  702. </description>
  703. </method>
  704. <method name="shaped_text_get_descent" qualifiers="const">
  705. <return type="float">
  706. </return>
  707. <argument index="0" name="shaped" type="RID">
  708. </argument>
  709. <description>
  710. Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
  711. Note: overall descent can be higher than font descent, if some glyphs are displaced from the baseline.
  712. </description>
  713. </method>
  714. <method name="shaped_text_get_direction" qualifiers="const">
  715. <return type="int" enum="TextServer.Direction">
  716. </return>
  717. <argument index="0" name="shaped" type="RID">
  718. </argument>
  719. <description>
  720. Returns direction of the text.
  721. </description>
  722. </method>
  723. <method name="shaped_text_get_dominant_direciton_in_range" qualifiers="const">
  724. <return type="int" enum="TextServer.Direction">
  725. </return>
  726. <argument index="0" name="shaped" type="RID">
  727. </argument>
  728. <argument index="1" name="start" type="int">
  729. </argument>
  730. <argument index="2" name="end" type="int">
  731. </argument>
  732. <description>
  733. Returns dominant direction of in the range of text.
  734. </description>
  735. </method>
  736. <method name="shaped_text_get_glyphs" qualifiers="const">
  737. <return type="Array">
  738. </return>
  739. <argument index="0" name="shaped" type="RID">
  740. </argument>
  741. <description>
  742. Returns text glyphs.
  743. </description>
  744. </method>
  745. <method name="shaped_text_get_line_breaks" qualifiers="const">
  746. <return type="Array">
  747. </return>
  748. <argument index="0" name="shaped" type="RID">
  749. </argument>
  750. <argument index="1" name="width" type="float">
  751. </argument>
  752. <argument index="2" name="start" type="int" default="0">
  753. </argument>
  754. <argument index="3" name="break_flags" type="int" default="48">
  755. </argument>
  756. <description>
  757. Breaks text to the lines and returns character ranges for each line.
  758. </description>
  759. </method>
  760. <method name="shaped_text_get_line_breaks_adv" qualifiers="const">
  761. <return type="Array">
  762. </return>
  763. <argument index="0" name="shaped" type="RID">
  764. </argument>
  765. <argument index="1" name="width" type="PackedFloat32Array">
  766. </argument>
  767. <argument index="2" name="start" type="int" default="0">
  768. </argument>
  769. <argument index="3" name="once" type="bool" default="true">
  770. </argument>
  771. <argument index="4" name="break_flags" type="int" default="48">
  772. </argument>
  773. <description>
  774. Breaks text to the lines and columns. Returns character ranges for each segment.
  775. </description>
  776. </method>
  777. <method name="shaped_text_get_object_rect" qualifiers="const">
  778. <return type="Rect2">
  779. </return>
  780. <argument index="0" name="shaped" type="RID">
  781. </argument>
  782. <argument index="1" name="key" type="Variant">
  783. </argument>
  784. <description>
  785. Returns bounding rectangle of the inline object.
  786. </description>
  787. </method>
  788. <method name="shaped_text_get_objects" qualifiers="const">
  789. <return type="Array">
  790. </return>
  791. <argument index="0" name="shaped" type="RID">
  792. </argument>
  793. <description>
  794. Returns array of inline objects.
  795. </description>
  796. </method>
  797. <method name="shaped_text_get_orientation" qualifiers="const">
  798. <return type="int" enum="TextServer.Orientation">
  799. </return>
  800. <argument index="0" name="shaped" type="RID">
  801. </argument>
  802. <description>
  803. Returns text orientation.
  804. </description>
  805. </method>
  806. <method name="shaped_text_get_parent" qualifiers="const">
  807. <return type="RID">
  808. </return>
  809. <argument index="0" name="shaped" type="RID">
  810. </argument>
  811. <description>
  812. Sets text orientation.
  813. </description>
  814. </method>
  815. <method name="shaped_text_get_preserve_control" qualifiers="const">
  816. <return type="bool">
  817. </return>
  818. <argument index="0" name="shaped" type="RID">
  819. </argument>
  820. <description>
  821. Returns [code]true[/code] if text buffer is configured to display control characters.
  822. </description>
  823. </method>
  824. <method name="shaped_text_get_preserve_invalid" qualifiers="const">
  825. <return type="bool">
  826. </return>
  827. <argument index="0" name="shaped" type="RID">
  828. </argument>
  829. <description>
  830. Returns [code]true[/code] if text buffer is configured to display hexadecimal codes in place of invalid characters.
  831. Note: If set to [code]false[/code], nothing is displayed in place of invalid characters.
  832. </description>
  833. </method>
  834. <method name="shaped_text_get_range" qualifiers="const">
  835. <return type="Vector2i">
  836. </return>
  837. <argument index="0" name="shaped" type="RID">
  838. </argument>
  839. <description>
  840. Returns substring buffer character range in the parent buffer.
  841. </description>
  842. </method>
  843. <method name="shaped_text_get_selection" qualifiers="const">
  844. <return type="Array">
  845. </return>
  846. <argument index="0" name="shaped" type="RID">
  847. </argument>
  848. <argument index="1" name="start" type="int">
  849. </argument>
  850. <argument index="2" name="end" type="int">
  851. </argument>
  852. <description>
  853. Returns selection rectangles for the specified character range.
  854. </description>
  855. </method>
  856. <method name="shaped_text_get_size" qualifiers="const">
  857. <return type="Vector2">
  858. </return>
  859. <argument index="0" name="shaped" type="RID">
  860. </argument>
  861. <description>
  862. Returns size of the text.
  863. </description>
  864. </method>
  865. <method name="shaped_text_get_underline_position" qualifiers="const">
  866. <return type="float">
  867. </return>
  868. <argument index="0" name="shaped" type="RID">
  869. </argument>
  870. <description>
  871. Returns pixel offset of the underline below the baseline.
  872. </description>
  873. </method>
  874. <method name="shaped_text_get_underline_thickness" qualifiers="const">
  875. <return type="float">
  876. </return>
  877. <argument index="0" name="shaped" type="RID">
  878. </argument>
  879. <description>
  880. Returns thickness of the underline.
  881. </description>
  882. </method>
  883. <method name="shaped_text_get_width" qualifiers="const">
  884. <return type="float">
  885. </return>
  886. <argument index="0" name="shaped" type="RID">
  887. </argument>
  888. <description>
  889. Returns width (for horizontal layout) or height (for vertical) of the text.
  890. </description>
  891. </method>
  892. <method name="shaped_text_get_word_breaks" qualifiers="const">
  893. <return type="Array">
  894. </return>
  895. <argument index="0" name="shaped" type="RID">
  896. </argument>
  897. <description>
  898. Breaks text into words and returns array of character ranges.
  899. </description>
  900. </method>
  901. <method name="shaped_text_hit_test_grapheme" qualifiers="const">
  902. <return type="int">
  903. </return>
  904. <argument index="0" name="shaped" type="RID">
  905. </argument>
  906. <argument index="1" name="coords" type="float">
  907. </argument>
  908. <description>
  909. Returns grapheme index at the specified pixel offset at the baseline, or [code]-1[/code] if none is found.
  910. </description>
  911. </method>
  912. <method name="shaped_text_hit_test_position" qualifiers="const">
  913. <return type="int">
  914. </return>
  915. <argument index="0" name="shaped" type="RID">
  916. </argument>
  917. <argument index="1" name="coords" type="float">
  918. </argument>
  919. <description>
  920. Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
  921. </description>
  922. </method>
  923. <method name="shaped_text_is_ready" qualifiers="const">
  924. <return type="bool">
  925. </return>
  926. <argument index="0" name="shaped" type="RID">
  927. </argument>
  928. <description>
  929. Returns [code]true[/code] if buffer is successfully shaped.
  930. </description>
  931. </method>
  932. <method name="shaped_text_next_grapheme_pos">
  933. <return type="int">
  934. </return>
  935. <argument index="0" name="shaped" type="RID">
  936. </argument>
  937. <argument index="1" name="pos" type="int">
  938. </argument>
  939. <description>
  940. Returns composite character end position closest to the [code]pos[/code].
  941. </description>
  942. </method>
  943. <method name="shaped_text_prev_grapheme_pos">
  944. <return type="int">
  945. </return>
  946. <argument index="0" name="shaped" type="RID">
  947. </argument>
  948. <argument index="1" name="pos" type="int">
  949. </argument>
  950. <description>
  951. Returns composite character start position closest to the [code]pos[/code].
  952. </description>
  953. </method>
  954. <method name="shaped_text_resize_object">
  955. <return type="bool">
  956. </return>
  957. <argument index="0" name="shaped" type="RID">
  958. </argument>
  959. <argument index="1" name="key" type="Variant">
  960. </argument>
  961. <argument index="2" name="size" type="Vector2">
  962. </argument>
  963. <argument index="3" name="inline_align" type="int" enum="VAlign" default="1">
  964. </argument>
  965. <description>
  966. Sets new size and alignment of embedded object.
  967. </description>
  968. </method>
  969. <method name="shaped_text_set_bidi_override">
  970. <return type="void">
  971. </return>
  972. <argument index="0" name="shaped" type="RID">
  973. </argument>
  974. <argument index="1" name="override" type="Array">
  975. </argument>
  976. <description>
  977. Overrides BiDi for the structured text.
  978. Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.
  979. </description>
  980. </method>
  981. <method name="shaped_text_set_direction">
  982. <return type="void">
  983. </return>
  984. <argument index="0" name="shaped" type="RID">
  985. </argument>
  986. <argument index="1" name="direction" type="int" enum="TextServer.Direction" default="0">
  987. </argument>
  988. <description>
  989. Sets desired text direction. If set to [code]TEXT_DIRECTION_AUTO[/code], direction will be detected based on the buffer contents and current locale.
  990. Note: Direction is ignored if server does not support [code]FEATURE_BIDI_LAYOUT[/code] feature.
  991. </description>
  992. </method>
  993. <method name="shaped_text_set_orientation">
  994. <return type="void">
  995. </return>
  996. <argument index="0" name="shaped" type="RID">
  997. </argument>
  998. <argument index="1" name="orientation" type="int" enum="TextServer.Orientation" default="0">
  999. </argument>
  1000. <description>
  1001. Sets desired text orientation.
  1002. Note: Orientation is ignored if server does not support [code]FEATURE_VERTICAL_LAYOUT[/code] feature.
  1003. </description>
  1004. </method>
  1005. <method name="shaped_text_set_preserve_control">
  1006. <return type="void">
  1007. </return>
  1008. <argument index="0" name="shaped" type="RID">
  1009. </argument>
  1010. <argument index="1" name="enabled" type="bool">
  1011. </argument>
  1012. <description>
  1013. If set to [code]true[/code] text buffer will display control characters.
  1014. </description>
  1015. </method>
  1016. <method name="shaped_text_set_preserve_invalid">
  1017. <return type="void">
  1018. </return>
  1019. <argument index="0" name="shaped" type="RID">
  1020. </argument>
  1021. <argument index="1" name="enabled" type="bool">
  1022. </argument>
  1023. <description>
  1024. If set to [code]true[/code] text buffer will display invalid characters as hexadecimal codes, otherwise nothing is displayed.
  1025. </description>
  1026. </method>
  1027. <method name="shaped_text_shape">
  1028. <return type="bool">
  1029. </return>
  1030. <argument index="0" name="shaped" type="RID">
  1031. </argument>
  1032. <description>
  1033. Shapes buffer if it's not shaped. Returns [code]true[/code] if the string is shaped successfully.
  1034. Note: It is not necessary to call this function manually, buffer will be shaped automatically as soon as any of its output data is requested.
  1035. </description>
  1036. </method>
  1037. <method name="shaped_text_substr" qualifiers="const">
  1038. <return type="RID">
  1039. </return>
  1040. <argument index="0" name="shaped" type="RID">
  1041. </argument>
  1042. <argument index="1" name="start" type="int">
  1043. </argument>
  1044. <argument index="2" name="length" type="int">
  1045. </argument>
  1046. <description>
  1047. Returns text buffer for the substring of the text in the [code]shaped[/code] text buffer (including inline objects).
  1048. </description>
  1049. </method>
  1050. <method name="shaped_text_tab_align">
  1051. <return type="float">
  1052. </return>
  1053. <argument index="0" name="shaped" type="RID">
  1054. </argument>
  1055. <argument index="1" name="tab_stops" type="PackedFloat32Array">
  1056. </argument>
  1057. <description>
  1058. Aligns shaped text to the given tab-stops.
  1059. </description>
  1060. </method>
  1061. <method name="tag_to_name">
  1062. <return type="String">
  1063. </return>
  1064. <argument index="0" name="tag" type="int">
  1065. </argument>
  1066. <description>
  1067. Converts OpenType tag to readable feature, variation, script or language name.
  1068. </description>
  1069. </method>
  1070. </methods>
  1071. <constants>
  1072. <constant name="DIRECTION_AUTO" value="0" enum="Direction">
  1073. Text direction is determined based on contents and current locale.
  1074. </constant>
  1075. <constant name="DIRECTION_LTR" value="1" enum="Direction">
  1076. Text is written from left to right.
  1077. </constant>
  1078. <constant name="DIRECTION_RTL" value="2" enum="Direction">
  1079. Text is written from right to left.
  1080. </constant>
  1081. <constant name="ORIENTATION_HORIZONTAL" value="0" enum="Orientation">
  1082. Text is written horizontally.
  1083. </constant>
  1084. <constant name="ORIENTATION_VERTICAL" value="1" enum="Orientation">
  1085. Left to right text is written vertically from top to bottom.
  1086. Right to left text is written vertically from bottom to top.
  1087. </constant>
  1088. <constant name="JUSTIFICATION_NONE" value="0" enum="JustificationFlag">
  1089. Do not justify text.
  1090. </constant>
  1091. <constant name="JUSTIFICATION_KASHIDA" value="1" enum="JustificationFlag">
  1092. Justify text by adding and removing kashidas.
  1093. </constant>
  1094. <constant name="JUSTIFICATION_WORD_BOUND" value="2" enum="JustificationFlag">
  1095. Justify text by changing width of the spaces between the words.
  1096. </constant>
  1097. <constant name="JUSTIFICATION_TRIM_EDGE_SPACES" value="4" enum="JustificationFlag">
  1098. Remove trailing and leading spaces from the justified text.
  1099. </constant>
  1100. <constant name="JUSTIFICATION_AFTER_LAST_TAB" value="8" enum="JustificationFlag">
  1101. Only apply justification to the part of the text after the last tab.
  1102. </constant>
  1103. <constant name="BREAK_NONE" value="0" enum="LineBreakFlag">
  1104. Do not break the line.
  1105. </constant>
  1106. <constant name="BREAK_MANDATORY" value="16" enum="LineBreakFlag">
  1107. Break the line at the line mandatory break characters (e.g. [code]"\n"[/code]).
  1108. </constant>
  1109. <constant name="BREAK_WORD_BOUND" value="32" enum="LineBreakFlag">
  1110. Break the line between the words.
  1111. </constant>
  1112. <constant name="BREAK_GRAPHEME_BOUND" value="64" enum="LineBreakFlag">
  1113. Break the line between any unconnected graphemes.
  1114. </constant>
  1115. <constant name="GRAPHEME_IS_RTL" value="2" enum="GraphemeFlag">
  1116. Grapheme is part of right-to-left or bottom-to-top run.
  1117. </constant>
  1118. <constant name="GRAPHEME_IS_VIRTUAL" value="4" enum="GraphemeFlag">
  1119. Grapheme is not part of source text, it was added by justification process.
  1120. </constant>
  1121. <constant name="GRAPHEME_IS_SPACE" value="8" enum="GraphemeFlag">
  1122. Grapheme is whitespace.
  1123. </constant>
  1124. <constant name="GRAPHEME_IS_BREAK_HARD" value="16" enum="GraphemeFlag">
  1125. Grapheme is mandatory break point (e.g. [code]"\n"[/code]).
  1126. </constant>
  1127. <constant name="GRAPHEME_IS_BREAK_SOFT" value="32" enum="GraphemeFlag">
  1128. Grapheme is optional break point (e.g. space).
  1129. </constant>
  1130. <constant name="GRAPHEME_IS_TAB" value="64" enum="GraphemeFlag">
  1131. Grapheme is the tabulation character.
  1132. </constant>
  1133. <constant name="GRAPHEME_IS_ELONGATION" value="128" enum="GraphemeFlag">
  1134. Grapheme is kashida.
  1135. </constant>
  1136. <constant name="HINTING_NONE" value="0" enum="Hinting">
  1137. Disables font hinting (smoother but less crisp).
  1138. </constant>
  1139. <constant name="HINTING_LIGHT" value="1" enum="Hinting">
  1140. Use the light font hinting mode.
  1141. </constant>
  1142. <constant name="HINTING_NORMAL" value="2" enum="Hinting">
  1143. Use the default font hinting mode (crisper but less smooth).
  1144. </constant>
  1145. <constant name="FEATURE_BIDI_LAYOUT" value="1" enum="Feature">
  1146. TextServer supports bidirectional layouts.
  1147. </constant>
  1148. <constant name="FEATURE_VERTICAL_LAYOUT" value="2" enum="Feature">
  1149. TextServer supports vertical layouts.
  1150. </constant>
  1151. <constant name="FEATURE_SHAPING" value="4" enum="Feature">
  1152. TextServer supports complex text shaping.
  1153. </constant>
  1154. <constant name="FEATURE_KASHIDA_JUSTIFICATION" value="8" enum="Feature">
  1155. TextServer supports justification using kashidas.
  1156. </constant>
  1157. <constant name="FEATURE_BREAK_ITERATORS" value="16" enum="Feature">
  1158. TextServer supports complex line/word breaking rules (e.g. dictionary based).
  1159. </constant>
  1160. <constant name="FEATURE_FONT_SYSTEM" value="32" enum="Feature">
  1161. TextServer supports loading system fonts.
  1162. </constant>
  1163. <constant name="FEATURE_USE_SUPPORT_DATA" value="64" enum="Feature">
  1164. TextServer require external data file for some features.
  1165. </constant>
  1166. </constants>
  1167. </class>