text_server_extension.cpp 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575
  1. /*************************************************************************/
  2. /* text_server_extension.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "text_server_extension.h"
  31. void TextServerExtension::_bind_methods() {
  32. GDVIRTUAL_BIND(has_feature, "feature");
  33. GDVIRTUAL_BIND(get_name);
  34. GDVIRTUAL_BIND(get_features);
  35. GDVIRTUAL_BIND(free_rid, "rid");
  36. GDVIRTUAL_BIND(has, "rid");
  37. GDVIRTUAL_BIND(load_support_data, "filename");
  38. GDVIRTUAL_BIND(get_support_data_filename);
  39. GDVIRTUAL_BIND(get_support_data_info);
  40. GDVIRTUAL_BIND(save_support_data, "filename");
  41. GDVIRTUAL_BIND(is_locale_right_to_left, "locale");
  42. GDVIRTUAL_BIND(name_to_tag, "name");
  43. GDVIRTUAL_BIND(tag_to_name, "tag");
  44. /* Font interface */
  45. GDVIRTUAL_BIND(create_font);
  46. GDVIRTUAL_BIND(font_set_data, "font_rid", "data");
  47. GDVIRTUAL_BIND(font_set_data_ptr, "font_rid", "data_ptr", "data_size");
  48. GDVIRTUAL_BIND(font_set_face_index, "font_rid", "face_index");
  49. GDVIRTUAL_BIND(font_get_face_index, "font_rid");
  50. GDVIRTUAL_BIND(font_get_face_count, "font_rid");
  51. GDVIRTUAL_BIND(font_set_style, "font_rid", "style");
  52. GDVIRTUAL_BIND(font_get_style, "font_rid");
  53. GDVIRTUAL_BIND(font_set_name, "font_rid", "name");
  54. GDVIRTUAL_BIND(font_get_name, "font_rid");
  55. GDVIRTUAL_BIND(font_set_style_name, "font_rid", "name_style");
  56. GDVIRTUAL_BIND(font_get_style_name, "font_rid");
  57. GDVIRTUAL_BIND(font_set_antialiased, "font_rid", "antialiased");
  58. GDVIRTUAL_BIND(font_is_antialiased, "font_rid");
  59. GDVIRTUAL_BIND(font_set_generate_mipmaps, "font_rid", "generate_mipmaps");
  60. GDVIRTUAL_BIND(font_get_generate_mipmaps, "font_rid");
  61. GDVIRTUAL_BIND(font_set_multichannel_signed_distance_field, "font_rid", "msdf");
  62. GDVIRTUAL_BIND(font_is_multichannel_signed_distance_field, "font_rid");
  63. GDVIRTUAL_BIND(font_set_msdf_pixel_range, "font_rid", "msdf_pixel_range");
  64. GDVIRTUAL_BIND(font_get_msdf_pixel_range, "font_rid");
  65. GDVIRTUAL_BIND(font_set_msdf_size, "font_rid", "msdf_size");
  66. GDVIRTUAL_BIND(font_get_msdf_size, "font_rid");
  67. GDVIRTUAL_BIND(font_set_fixed_size, "font_rid", "fixed_size");
  68. GDVIRTUAL_BIND(font_get_fixed_size, "font_rid");
  69. GDVIRTUAL_BIND(font_set_force_autohinter, "font_rid", "force_autohinter");
  70. GDVIRTUAL_BIND(font_is_force_autohinter, "font_rid");
  71. GDVIRTUAL_BIND(font_set_hinting, "font_rid", "hinting");
  72. GDVIRTUAL_BIND(font_get_hinting, "font_rid");
  73. GDVIRTUAL_BIND(font_set_subpixel_positioning, "font_rid", "subpixel_positioning");
  74. GDVIRTUAL_BIND(font_get_subpixel_positioning, "font_rid");
  75. GDVIRTUAL_BIND(font_set_embolden, "font_rid", "strength");
  76. GDVIRTUAL_BIND(font_get_embolden, "font_rid");
  77. GDVIRTUAL_BIND(font_set_transform, "font_rid", "transform");
  78. GDVIRTUAL_BIND(font_get_transform, "font_rid");
  79. GDVIRTUAL_BIND(font_set_variation_coordinates, "font_rid", "variation_coordinates");
  80. GDVIRTUAL_BIND(font_get_variation_coordinates, "font_rid");
  81. GDVIRTUAL_BIND(font_set_oversampling, "font_rid", "oversampling");
  82. GDVIRTUAL_BIND(font_get_oversampling, "font_rid");
  83. GDVIRTUAL_BIND(font_get_size_cache_list, "font_rid");
  84. GDVIRTUAL_BIND(font_clear_size_cache, "font_rid");
  85. GDVIRTUAL_BIND(font_remove_size_cache, "font_rid", "size");
  86. GDVIRTUAL_BIND(font_set_ascent, "font_rid", "size", "ascent");
  87. GDVIRTUAL_BIND(font_get_ascent, "font_rid", "size");
  88. GDVIRTUAL_BIND(font_set_descent, "font_rid", "size", "descent");
  89. GDVIRTUAL_BIND(font_get_descent, "font_rid", "size");
  90. GDVIRTUAL_BIND(font_set_underline_position, "font_rid", "size", "underline_position");
  91. GDVIRTUAL_BIND(font_get_underline_position, "font_rid", "size");
  92. GDVIRTUAL_BIND(font_set_underline_thickness, "font_rid", "size", "underline_thickness");
  93. GDVIRTUAL_BIND(font_get_underline_thickness, "font_rid", "size");
  94. GDVIRTUAL_BIND(font_set_scale, "font_rid", "size", "scale");
  95. GDVIRTUAL_BIND(font_get_scale, "font_rid", "size");
  96. GDVIRTUAL_BIND(font_get_texture_count, "font_rid", "size");
  97. GDVIRTUAL_BIND(font_clear_textures, "font_rid", "size");
  98. GDVIRTUAL_BIND(font_remove_texture, "font_rid", "size", "texture_index");
  99. GDVIRTUAL_BIND(font_set_texture_image, "font_rid", "size", "texture_index", "image");
  100. GDVIRTUAL_BIND(font_get_texture_image, "font_rid", "size", "texture_index");
  101. GDVIRTUAL_BIND(font_set_texture_offsets, "font_rid", "size", "texture_index", "offset");
  102. GDVIRTUAL_BIND(font_get_texture_offsets, "font_rid", "size", "texture_index");
  103. GDVIRTUAL_BIND(font_get_glyph_list, "font_rid", "size");
  104. GDVIRTUAL_BIND(font_clear_glyphs, "font_rid", "size");
  105. GDVIRTUAL_BIND(font_remove_glyph, "font_rid", "size", "glyph");
  106. GDVIRTUAL_BIND(font_get_glyph_advance, "font_rid", "size", "glyph");
  107. GDVIRTUAL_BIND(font_set_glyph_advance, "font_rid", "size", "glyph", "advance");
  108. GDVIRTUAL_BIND(font_get_glyph_offset, "font_rid", "size", "glyph");
  109. GDVIRTUAL_BIND(font_set_glyph_offset, "font_rid", "size", "glyph", "offset");
  110. GDVIRTUAL_BIND(font_get_glyph_size, "font_rid", "size", "glyph");
  111. GDVIRTUAL_BIND(font_set_glyph_size, "font_rid", "size", "glyph", "gl_size");
  112. GDVIRTUAL_BIND(font_get_glyph_uv_rect, "font_rid", "size", "glyph");
  113. GDVIRTUAL_BIND(font_set_glyph_uv_rect, "font_rid", "size", "glyph", "uv_rect");
  114. GDVIRTUAL_BIND(font_get_glyph_texture_idx, "font_rid", "size", "glyph");
  115. GDVIRTUAL_BIND(font_set_glyph_texture_idx, "font_rid", "size", "glyph", "texture_idx");
  116. GDVIRTUAL_BIND(font_get_glyph_texture_rid, "font_rid", "size", "glyph");
  117. GDVIRTUAL_BIND(font_get_glyph_texture_size, "font_rid", "size", "glyph");
  118. GDVIRTUAL_BIND(font_get_glyph_contours, "font_rid", "size", "index");
  119. GDVIRTUAL_BIND(font_get_kerning_list, "font_rid", "size");
  120. GDVIRTUAL_BIND(font_clear_kerning_map, "font_rid", "size");
  121. GDVIRTUAL_BIND(font_remove_kerning, "font_rid", "size", "glyph_pair");
  122. GDVIRTUAL_BIND(font_set_kerning, "font_rid", "size", "glyph_pair", "kerning");
  123. GDVIRTUAL_BIND(font_get_kerning, "font_rid", "size", "glyph_pair");
  124. GDVIRTUAL_BIND(font_get_glyph_index, "font_rid", "size", "char", "variation_selector");
  125. GDVIRTUAL_BIND(font_has_char, "font_rid", "char");
  126. GDVIRTUAL_BIND(font_get_supported_chars, "font_rid");
  127. GDVIRTUAL_BIND(font_render_range, "font_rid", "size", "start", "end");
  128. GDVIRTUAL_BIND(font_render_glyph, "font_rid", "size", "index");
  129. GDVIRTUAL_BIND(font_draw_glyph, "font_rid", "canvas", "size", "pos", "index", "color");
  130. GDVIRTUAL_BIND(font_draw_glyph_outline, "font_rid", "canvas", "size", "outline_size", "pos", "index", "color");
  131. GDVIRTUAL_BIND(font_is_language_supported, "font_rid", "language");
  132. GDVIRTUAL_BIND(font_set_language_support_override, "font_rid", "language", "supported");
  133. GDVIRTUAL_BIND(font_get_language_support_override, "font_rid", "language");
  134. GDVIRTUAL_BIND(font_remove_language_support_override, "font_rid", "language");
  135. GDVIRTUAL_BIND(font_get_language_support_overrides, "font_rid");
  136. GDVIRTUAL_BIND(font_is_script_supported, "font_rid", "script");
  137. GDVIRTUAL_BIND(font_set_script_support_override, "font_rid", "script", "supported");
  138. GDVIRTUAL_BIND(font_get_script_support_override, "font_rid", "script");
  139. GDVIRTUAL_BIND(font_remove_script_support_override, "font_rid", "script");
  140. GDVIRTUAL_BIND(font_get_script_support_overrides, "font_rid");
  141. GDVIRTUAL_BIND(font_set_opentype_feature_overrides, "font_rid", "overrides");
  142. GDVIRTUAL_BIND(font_get_opentype_feature_overrides, "font_rid");
  143. GDVIRTUAL_BIND(font_supported_feature_list, "font_rid");
  144. GDVIRTUAL_BIND(font_supported_variation_list, "font_rid");
  145. GDVIRTUAL_BIND(font_get_global_oversampling);
  146. GDVIRTUAL_BIND(font_set_global_oversampling, "oversampling");
  147. GDVIRTUAL_BIND(get_hex_code_box_size, "size", "index");
  148. GDVIRTUAL_BIND(draw_hex_code_box, "canvas", "size", "pos", "index", "color");
  149. /* Shaped text buffer interface */
  150. GDVIRTUAL_BIND(create_shaped_text, "direction", "orientation");
  151. GDVIRTUAL_BIND(shaped_text_clear, "shaped");
  152. GDVIRTUAL_BIND(shaped_text_set_direction, "shaped", "direction");
  153. GDVIRTUAL_BIND(shaped_text_get_direction, "shaped");
  154. GDVIRTUAL_BIND(shaped_text_get_inferred_direction, "shaped");
  155. GDVIRTUAL_BIND(shaped_text_set_bidi_override, "shaped", "override");
  156. GDVIRTUAL_BIND(shaped_text_set_custom_punctuation, "shaped", "punct");
  157. GDVIRTUAL_BIND(shaped_text_get_custom_punctuation, "shaped");
  158. GDVIRTUAL_BIND(shaped_text_set_orientation, "shaped", "orientation");
  159. GDVIRTUAL_BIND(shaped_text_get_orientation, "shaped");
  160. GDVIRTUAL_BIND(shaped_text_set_preserve_invalid, "shaped", "enabled");
  161. GDVIRTUAL_BIND(shaped_text_get_preserve_invalid, "shaped");
  162. GDVIRTUAL_BIND(shaped_text_set_preserve_control, "shaped", "enabled");
  163. GDVIRTUAL_BIND(shaped_text_get_preserve_control, "shaped");
  164. GDVIRTUAL_BIND(shaped_text_set_spacing, "shaped", "spacing", "value");
  165. GDVIRTUAL_BIND(shaped_text_get_spacing, "shaped", "spacing");
  166. GDVIRTUAL_BIND(shaped_text_add_string, "shaped", "text", "fonts", "size", "opentype_features", "language", "meta");
  167. GDVIRTUAL_BIND(shaped_text_add_object, "shaped", "key", "size", "inline_align", "length");
  168. GDVIRTUAL_BIND(shaped_text_resize_object, "shaped", "key", "size", "inline_align");
  169. GDVIRTUAL_BIND(shaped_get_span_count, "shaped");
  170. GDVIRTUAL_BIND(shaped_get_span_meta, "shaped", "index");
  171. GDVIRTUAL_BIND(shaped_set_span_update_font, "shaped", "index", "fonts", "size", "opentype_features");
  172. GDVIRTUAL_BIND(shaped_text_substr, "shaped", "start", "length");
  173. GDVIRTUAL_BIND(shaped_text_get_parent, "shaped");
  174. GDVIRTUAL_BIND(shaped_text_fit_to_width, "shaped", "width", "jst_flags");
  175. GDVIRTUAL_BIND(shaped_text_tab_align, "shaped", "tab_stops");
  176. GDVIRTUAL_BIND(shaped_text_shape, "shaped");
  177. GDVIRTUAL_BIND(shaped_text_update_breaks, "shaped");
  178. GDVIRTUAL_BIND(shaped_text_update_justification_ops, "shaped");
  179. GDVIRTUAL_BIND(shaped_text_is_ready, "shaped");
  180. GDVIRTUAL_BIND(shaped_text_get_glyphs, "shaped");
  181. GDVIRTUAL_BIND(shaped_text_sort_logical, "shaped");
  182. GDVIRTUAL_BIND(shaped_text_get_glyph_count, "shaped");
  183. GDVIRTUAL_BIND(shaped_text_get_range, "shaped");
  184. GDVIRTUAL_BIND(shaped_text_get_line_breaks_adv, "shaped", "width", "start", "once", "break_flags");
  185. GDVIRTUAL_BIND(shaped_text_get_line_breaks, "shaped", "width", "start", "break_flags");
  186. GDVIRTUAL_BIND(shaped_text_get_word_breaks, "shaped", "grapheme_flags");
  187. GDVIRTUAL_BIND(shaped_text_get_trim_pos, "shaped");
  188. GDVIRTUAL_BIND(shaped_text_get_ellipsis_pos, "shaped");
  189. GDVIRTUAL_BIND(shaped_text_get_ellipsis_glyph_count, "shaped");
  190. GDVIRTUAL_BIND(shaped_text_get_ellipsis_glyphs, "shaped");
  191. GDVIRTUAL_BIND(shaped_text_overrun_trim_to_width, "shaped", "width", "trim_flags");
  192. GDVIRTUAL_BIND(shaped_text_get_objects, "shaped");
  193. GDVIRTUAL_BIND(shaped_text_get_object_rect, "shaped", "key");
  194. GDVIRTUAL_BIND(shaped_text_get_size, "shaped");
  195. GDVIRTUAL_BIND(shaped_text_get_ascent, "shaped");
  196. GDVIRTUAL_BIND(shaped_text_get_descent, "shaped");
  197. GDVIRTUAL_BIND(shaped_text_get_width, "shaped");
  198. GDVIRTUAL_BIND(shaped_text_get_underline_position, "shaped");
  199. GDVIRTUAL_BIND(shaped_text_get_underline_thickness, "shaped");
  200. GDVIRTUAL_BIND(shaped_text_get_dominant_direction_in_range, "shaped", "start", "end");
  201. GDVIRTUAL_BIND(shaped_text_get_carets, "shaped", "position", "caret");
  202. GDVIRTUAL_BIND(shaped_text_get_selection, "shaped", "start", "end");
  203. GDVIRTUAL_BIND(shaped_text_hit_test_grapheme, "shaped", "coord");
  204. GDVIRTUAL_BIND(shaped_text_hit_test_position, "shaped", "coord");
  205. GDVIRTUAL_BIND(shaped_text_draw, "shaped", "canvas", "pos", "clip_l", "clip_r", "color");
  206. GDVIRTUAL_BIND(shaped_text_draw_outline, "shaped", "canvas", "pos", "clip_l", "clip_r", "outline_size", "color");
  207. GDVIRTUAL_BIND(shaped_text_get_grapheme_bounds, "shaped", "pos");
  208. GDVIRTUAL_BIND(shaped_text_next_grapheme_pos, "shaped", "pos");
  209. GDVIRTUAL_BIND(shaped_text_prev_grapheme_pos, "shaped", "pos");
  210. GDVIRTUAL_BIND(format_number, "string", "language");
  211. GDVIRTUAL_BIND(parse_number, "string", "language");
  212. GDVIRTUAL_BIND(percent_sign, "language");
  213. GDVIRTUAL_BIND(strip_diacritics, "string");
  214. GDVIRTUAL_BIND(is_valid_identifier, "string");
  215. GDVIRTUAL_BIND(string_get_word_breaks, "string", "language");
  216. GDVIRTUAL_BIND(is_confusable, "string", "dict");
  217. GDVIRTUAL_BIND(spoof_check, "string");
  218. GDVIRTUAL_BIND(string_to_upper, "string", "language");
  219. GDVIRTUAL_BIND(string_to_lower, "string", "language");
  220. GDVIRTUAL_BIND(parse_structured_text, "parser_type", "args", "text");
  221. }
  222. bool TextServerExtension::has_feature(Feature p_feature) const {
  223. bool ret;
  224. if (GDVIRTUAL_CALL(has_feature, p_feature, ret)) {
  225. return ret;
  226. }
  227. return false;
  228. }
  229. String TextServerExtension::get_name() const {
  230. String ret;
  231. if (GDVIRTUAL_CALL(get_name, ret)) {
  232. return ret;
  233. }
  234. return "Unknown";
  235. }
  236. int64_t TextServerExtension::get_features() const {
  237. int64_t ret;
  238. if (GDVIRTUAL_CALL(get_features, ret)) {
  239. return ret;
  240. }
  241. return 0;
  242. }
  243. void TextServerExtension::free_rid(const RID &p_rid) {
  244. GDVIRTUAL_CALL(free_rid, p_rid);
  245. }
  246. bool TextServerExtension::has(const RID &p_rid) {
  247. bool ret;
  248. if (GDVIRTUAL_CALL(has, p_rid, ret)) {
  249. return ret;
  250. }
  251. return false;
  252. }
  253. bool TextServerExtension::load_support_data(const String &p_filename) {
  254. bool ret;
  255. if (GDVIRTUAL_CALL(load_support_data, p_filename, ret)) {
  256. return ret;
  257. }
  258. return false;
  259. }
  260. String TextServerExtension::get_support_data_filename() const {
  261. String ret;
  262. if (GDVIRTUAL_CALL(get_support_data_filename, ret)) {
  263. return ret;
  264. }
  265. return String();
  266. }
  267. String TextServerExtension::get_support_data_info() const {
  268. String ret;
  269. if (GDVIRTUAL_CALL(get_support_data_info, ret)) {
  270. return ret;
  271. }
  272. return String();
  273. }
  274. bool TextServerExtension::save_support_data(const String &p_filename) const {
  275. bool ret;
  276. if (GDVIRTUAL_CALL(save_support_data, p_filename, ret)) {
  277. return ret;
  278. }
  279. return false;
  280. }
  281. bool TextServerExtension::is_locale_right_to_left(const String &p_locale) const {
  282. bool ret;
  283. if (GDVIRTUAL_CALL(is_locale_right_to_left, p_locale, ret)) {
  284. return ret;
  285. }
  286. return false;
  287. }
  288. int64_t TextServerExtension::name_to_tag(const String &p_name) const {
  289. int64_t ret;
  290. if (GDVIRTUAL_CALL(name_to_tag, p_name, ret)) {
  291. return ret;
  292. }
  293. return 0;
  294. }
  295. String TextServerExtension::tag_to_name(int64_t p_tag) const {
  296. String ret;
  297. if (GDVIRTUAL_CALL(tag_to_name, p_tag, ret)) {
  298. return ret;
  299. }
  300. return "";
  301. }
  302. /*************************************************************************/
  303. /* Font */
  304. /*************************************************************************/
  305. RID TextServerExtension::create_font() {
  306. RID ret;
  307. if (GDVIRTUAL_CALL(create_font, ret)) {
  308. return ret;
  309. }
  310. return RID();
  311. }
  312. void TextServerExtension::font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) {
  313. GDVIRTUAL_CALL(font_set_data, p_font_rid, p_data);
  314. }
  315. void TextServerExtension::font_set_data_ptr(const RID &p_font_rid, const uint8_t *p_data_ptr, int64_t p_data_size) {
  316. GDVIRTUAL_CALL(font_set_data_ptr, p_font_rid, p_data_ptr, p_data_size);
  317. }
  318. void TextServerExtension::font_set_face_index(const RID &p_font_rid, int64_t p_index) {
  319. GDVIRTUAL_CALL(font_set_face_index, p_font_rid, p_index);
  320. }
  321. int64_t TextServerExtension::font_get_face_index(const RID &p_font_rid) const {
  322. int64_t ret;
  323. if (GDVIRTUAL_CALL(font_get_face_index, p_font_rid, ret)) {
  324. return ret;
  325. }
  326. return 0;
  327. }
  328. int64_t TextServerExtension::font_get_face_count(const RID &p_font_rid) const {
  329. int64_t ret;
  330. if (GDVIRTUAL_CALL(font_get_face_count, p_font_rid, ret)) {
  331. return ret;
  332. }
  333. return 0;
  334. }
  335. void TextServerExtension::font_set_style(const RID &p_font_rid, BitField<TextServer::FontStyle> p_style) {
  336. GDVIRTUAL_CALL(font_set_style, p_font_rid, p_style);
  337. }
  338. BitField<TextServer::FontStyle> TextServerExtension::font_get_style(const RID &p_font_rid) const {
  339. BitField<TextServer::FontStyle> ret = 0;
  340. if (GDVIRTUAL_CALL(font_get_style, p_font_rid, ret)) {
  341. return ret;
  342. }
  343. return 0;
  344. }
  345. void TextServerExtension::font_set_style_name(const RID &p_font_rid, const String &p_name) {
  346. GDVIRTUAL_CALL(font_set_style_name, p_font_rid, p_name);
  347. }
  348. String TextServerExtension::font_get_style_name(const RID &p_font_rid) const {
  349. String ret;
  350. if (GDVIRTUAL_CALL(font_get_style_name, p_font_rid, ret)) {
  351. return ret;
  352. }
  353. return String();
  354. }
  355. void TextServerExtension::font_set_name(const RID &p_font_rid, const String &p_name) {
  356. GDVIRTUAL_CALL(font_set_name, p_font_rid, p_name);
  357. }
  358. String TextServerExtension::font_get_name(const RID &p_font_rid) const {
  359. String ret;
  360. if (GDVIRTUAL_CALL(font_get_name, p_font_rid, ret)) {
  361. return ret;
  362. }
  363. return String();
  364. }
  365. void TextServerExtension::font_set_antialiased(const RID &p_font_rid, bool p_antialiased) {
  366. GDVIRTUAL_CALL(font_set_antialiased, p_font_rid, p_antialiased);
  367. }
  368. bool TextServerExtension::font_is_antialiased(const RID &p_font_rid) const {
  369. bool ret;
  370. if (GDVIRTUAL_CALL(font_is_antialiased, p_font_rid, ret)) {
  371. return ret;
  372. }
  373. return false;
  374. }
  375. void TextServerExtension::font_set_generate_mipmaps(const RID &p_font_rid, bool p_generate_mipmaps) {
  376. GDVIRTUAL_CALL(font_set_generate_mipmaps, p_font_rid, p_generate_mipmaps);
  377. }
  378. bool TextServerExtension::font_get_generate_mipmaps(const RID &p_font_rid) const {
  379. bool ret;
  380. if (GDVIRTUAL_CALL(font_get_generate_mipmaps, p_font_rid, ret)) {
  381. return ret;
  382. }
  383. return false;
  384. }
  385. void TextServerExtension::font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) {
  386. GDVIRTUAL_CALL(font_set_multichannel_signed_distance_field, p_font_rid, p_msdf);
  387. }
  388. bool TextServerExtension::font_is_multichannel_signed_distance_field(const RID &p_font_rid) const {
  389. bool ret;
  390. if (GDVIRTUAL_CALL(font_is_multichannel_signed_distance_field, p_font_rid, ret)) {
  391. return ret;
  392. }
  393. return false;
  394. }
  395. void TextServerExtension::font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) {
  396. GDVIRTUAL_CALL(font_set_msdf_pixel_range, p_font_rid, p_msdf_pixel_range);
  397. }
  398. int64_t TextServerExtension::font_get_msdf_pixel_range(const RID &p_font_rid) const {
  399. int64_t ret;
  400. if (GDVIRTUAL_CALL(font_get_msdf_pixel_range, p_font_rid, ret)) {
  401. return ret;
  402. }
  403. return 0;
  404. }
  405. void TextServerExtension::font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) {
  406. GDVIRTUAL_CALL(font_set_msdf_size, p_font_rid, p_msdf_size);
  407. }
  408. int64_t TextServerExtension::font_get_msdf_size(const RID &p_font_rid) const {
  409. int64_t ret;
  410. if (GDVIRTUAL_CALL(font_get_msdf_size, p_font_rid, ret)) {
  411. return ret;
  412. }
  413. return 0;
  414. }
  415. void TextServerExtension::font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) {
  416. GDVIRTUAL_CALL(font_set_fixed_size, p_font_rid, p_fixed_size);
  417. }
  418. int64_t TextServerExtension::font_get_fixed_size(const RID &p_font_rid) const {
  419. int64_t ret;
  420. if (GDVIRTUAL_CALL(font_get_fixed_size, p_font_rid, ret)) {
  421. return ret;
  422. }
  423. return 0;
  424. }
  425. void TextServerExtension::font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) {
  426. GDVIRTUAL_CALL(font_set_force_autohinter, p_font_rid, p_force_autohinter);
  427. }
  428. bool TextServerExtension::font_is_force_autohinter(const RID &p_font_rid) const {
  429. bool ret;
  430. if (GDVIRTUAL_CALL(font_is_force_autohinter, p_font_rid, ret)) {
  431. return ret;
  432. }
  433. return false;
  434. }
  435. void TextServerExtension::font_set_hinting(const RID &p_font_rid, TextServer::Hinting p_hinting) {
  436. GDVIRTUAL_CALL(font_set_hinting, p_font_rid, p_hinting);
  437. }
  438. TextServer::Hinting TextServerExtension::font_get_hinting(const RID &p_font_rid) const {
  439. TextServer::Hinting ret;
  440. if (GDVIRTUAL_CALL(font_get_hinting, p_font_rid, ret)) {
  441. return (TextServer::Hinting)ret;
  442. }
  443. return TextServer::Hinting::HINTING_NONE;
  444. }
  445. void TextServerExtension::font_set_subpixel_positioning(const RID &p_font_rid, TextServer::SubpixelPositioning p_subpixel) {
  446. GDVIRTUAL_CALL(font_set_subpixel_positioning, p_font_rid, p_subpixel);
  447. }
  448. TextServer::SubpixelPositioning TextServerExtension::font_get_subpixel_positioning(const RID &p_font_rid) const {
  449. TextServer::SubpixelPositioning ret;
  450. if (GDVIRTUAL_CALL(font_get_subpixel_positioning, p_font_rid, ret)) {
  451. return (TextServer::SubpixelPositioning)ret;
  452. }
  453. return TextServer::SubpixelPositioning::SUBPIXEL_POSITIONING_DISABLED;
  454. }
  455. void TextServerExtension::font_set_embolden(const RID &p_font_rid, double p_strength) {
  456. GDVIRTUAL_CALL(font_set_embolden, p_font_rid, p_strength);
  457. }
  458. double TextServerExtension::font_get_embolden(const RID &p_font_rid) const {
  459. double ret;
  460. if (GDVIRTUAL_CALL(font_get_embolden, p_font_rid, ret)) {
  461. return ret;
  462. }
  463. return 0.0;
  464. }
  465. void TextServerExtension::font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) {
  466. GDVIRTUAL_CALL(font_set_transform, p_font_rid, p_transform);
  467. }
  468. Transform2D TextServerExtension::font_get_transform(const RID &p_font_rid) const {
  469. Transform2D ret;
  470. if (GDVIRTUAL_CALL(font_get_transform, p_font_rid, ret)) {
  471. return ret;
  472. }
  473. return Transform2D();
  474. }
  475. void TextServerExtension::font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) {
  476. GDVIRTUAL_CALL(font_set_variation_coordinates, p_font_rid, p_variation_coordinates);
  477. }
  478. Dictionary TextServerExtension::font_get_variation_coordinates(const RID &p_font_rid) const {
  479. Dictionary ret;
  480. if (GDVIRTUAL_CALL(font_get_variation_coordinates, p_font_rid, ret)) {
  481. return ret;
  482. }
  483. return Dictionary();
  484. }
  485. void TextServerExtension::font_set_oversampling(const RID &p_font_rid, double p_oversampling) {
  486. GDVIRTUAL_CALL(font_set_oversampling, p_font_rid, p_oversampling);
  487. }
  488. double TextServerExtension::font_get_oversampling(const RID &p_font_rid) const {
  489. double ret;
  490. if (GDVIRTUAL_CALL(font_get_oversampling, p_font_rid, ret)) {
  491. return ret;
  492. }
  493. return 0.0;
  494. }
  495. Array TextServerExtension::font_get_size_cache_list(const RID &p_font_rid) const {
  496. Array ret;
  497. if (GDVIRTUAL_CALL(font_get_size_cache_list, p_font_rid, ret)) {
  498. return ret;
  499. }
  500. return Array();
  501. }
  502. void TextServerExtension::font_clear_size_cache(const RID &p_font_rid) {
  503. GDVIRTUAL_CALL(font_clear_size_cache, p_font_rid);
  504. }
  505. void TextServerExtension::font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) {
  506. GDVIRTUAL_CALL(font_remove_size_cache, p_font_rid, p_size);
  507. }
  508. void TextServerExtension::font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) {
  509. GDVIRTUAL_CALL(font_set_ascent, p_font_rid, p_size, p_ascent);
  510. }
  511. double TextServerExtension::font_get_ascent(const RID &p_font_rid, int64_t p_size) const {
  512. double ret;
  513. if (GDVIRTUAL_CALL(font_get_ascent, p_font_rid, p_size, ret)) {
  514. return ret;
  515. }
  516. return 0.0;
  517. }
  518. void TextServerExtension::font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) {
  519. GDVIRTUAL_CALL(font_set_descent, p_font_rid, p_size, p_descent);
  520. }
  521. double TextServerExtension::font_get_descent(const RID &p_font_rid, int64_t p_size) const {
  522. double ret;
  523. if (GDVIRTUAL_CALL(font_get_descent, p_font_rid, p_size, ret)) {
  524. return ret;
  525. }
  526. return 0.0;
  527. }
  528. void TextServerExtension::font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) {
  529. GDVIRTUAL_CALL(font_set_underline_position, p_font_rid, p_size, p_underline_position);
  530. }
  531. double TextServerExtension::font_get_underline_position(const RID &p_font_rid, int64_t p_size) const {
  532. double ret;
  533. if (GDVIRTUAL_CALL(font_get_underline_position, p_font_rid, p_size, ret)) {
  534. return ret;
  535. }
  536. return 0.0;
  537. }
  538. void TextServerExtension::font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) {
  539. GDVIRTUAL_CALL(font_set_underline_thickness, p_font_rid, p_size, p_underline_thickness);
  540. }
  541. double TextServerExtension::font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const {
  542. double ret;
  543. if (GDVIRTUAL_CALL(font_get_underline_thickness, p_font_rid, p_size, ret)) {
  544. return ret;
  545. }
  546. return 0.0;
  547. }
  548. void TextServerExtension::font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) {
  549. GDVIRTUAL_CALL(font_set_scale, p_font_rid, p_size, p_scale);
  550. }
  551. double TextServerExtension::font_get_scale(const RID &p_font_rid, int64_t p_size) const {
  552. double ret;
  553. if (GDVIRTUAL_CALL(font_get_scale, p_font_rid, p_size, ret)) {
  554. return ret;
  555. }
  556. return 0.0;
  557. }
  558. int64_t TextServerExtension::font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const {
  559. int64_t ret;
  560. if (GDVIRTUAL_CALL(font_get_texture_count, p_font_rid, p_size, ret)) {
  561. return ret;
  562. }
  563. return 0;
  564. }
  565. void TextServerExtension::font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) {
  566. GDVIRTUAL_CALL(font_clear_textures, p_font_rid, p_size);
  567. }
  568. void TextServerExtension::font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) {
  569. GDVIRTUAL_CALL(font_remove_texture, p_font_rid, p_size, p_texture_index);
  570. }
  571. void TextServerExtension::font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) {
  572. GDVIRTUAL_CALL(font_set_texture_image, p_font_rid, p_size, p_texture_index, p_image);
  573. }
  574. Ref<Image> TextServerExtension::font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const {
  575. Ref<Image> ret;
  576. if (GDVIRTUAL_CALL(font_get_texture_image, p_font_rid, p_size, p_texture_index, ret)) {
  577. return ret;
  578. }
  579. return Ref<Image>();
  580. }
  581. void TextServerExtension::font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) {
  582. GDVIRTUAL_CALL(font_set_texture_offsets, p_font_rid, p_size, p_texture_index, p_offset);
  583. }
  584. PackedInt32Array TextServerExtension::font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const {
  585. PackedInt32Array ret;
  586. if (GDVIRTUAL_CALL(font_get_texture_offsets, p_font_rid, p_size, p_texture_index, ret)) {
  587. return ret;
  588. }
  589. return PackedInt32Array();
  590. }
  591. Array TextServerExtension::font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const {
  592. Array ret;
  593. if (GDVIRTUAL_CALL(font_get_glyph_list, p_font_rid, p_size, ret)) {
  594. return ret;
  595. }
  596. return Array();
  597. }
  598. void TextServerExtension::font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) {
  599. GDVIRTUAL_CALL(font_clear_glyphs, p_font_rid, p_size);
  600. }
  601. void TextServerExtension::font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) {
  602. GDVIRTUAL_CALL(font_remove_glyph, p_font_rid, p_size, p_glyph);
  603. }
  604. Vector2 TextServerExtension::font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const {
  605. Vector2 ret;
  606. if (GDVIRTUAL_CALL(font_get_glyph_advance, p_font_rid, p_size, p_glyph, ret)) {
  607. return ret;
  608. }
  609. return Vector2();
  610. }
  611. void TextServerExtension::font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) {
  612. GDVIRTUAL_CALL(font_set_glyph_advance, p_font_rid, p_size, p_glyph, p_advance);
  613. }
  614. Vector2 TextServerExtension::font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
  615. Vector2 ret;
  616. if (GDVIRTUAL_CALL(font_get_glyph_offset, p_font_rid, p_size, p_glyph, ret)) {
  617. return ret;
  618. }
  619. return Vector2();
  620. }
  621. void TextServerExtension::font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) {
  622. GDVIRTUAL_CALL(font_set_glyph_offset, p_font_rid, p_size, p_glyph, p_offset);
  623. }
  624. Vector2 TextServerExtension::font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
  625. Vector2 ret;
  626. if (GDVIRTUAL_CALL(font_get_glyph_size, p_font_rid, p_size, p_glyph, ret)) {
  627. return ret;
  628. }
  629. return Vector2();
  630. }
  631. void TextServerExtension::font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) {
  632. GDVIRTUAL_CALL(font_set_glyph_size, p_font_rid, p_size, p_glyph, p_gl_size);
  633. }
  634. Rect2 TextServerExtension::font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
  635. Rect2 ret;
  636. if (GDVIRTUAL_CALL(font_get_glyph_uv_rect, p_font_rid, p_size, p_glyph, ret)) {
  637. return ret;
  638. }
  639. return Rect2();
  640. }
  641. void TextServerExtension::font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) {
  642. GDVIRTUAL_CALL(font_set_glyph_uv_rect, p_font_rid, p_size, p_glyph, p_uv_rect);
  643. }
  644. int64_t TextServerExtension::font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
  645. int64_t ret;
  646. if (GDVIRTUAL_CALL(font_get_glyph_texture_idx, p_font_rid, p_size, p_glyph, ret)) {
  647. return ret;
  648. }
  649. return 0;
  650. }
  651. void TextServerExtension::font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) {
  652. GDVIRTUAL_CALL(font_set_glyph_texture_idx, p_font_rid, p_size, p_glyph, p_texture_idx);
  653. }
  654. RID TextServerExtension::font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
  655. RID ret;
  656. if (GDVIRTUAL_CALL(font_get_glyph_texture_rid, p_font_rid, p_size, p_glyph, ret)) {
  657. return ret;
  658. }
  659. return RID();
  660. }
  661. Size2 TextServerExtension::font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
  662. Size2 ret;
  663. if (GDVIRTUAL_CALL(font_get_glyph_texture_size, p_font_rid, p_size, p_glyph, ret)) {
  664. return ret;
  665. }
  666. return Size2();
  667. }
  668. Dictionary TextServerExtension::font_get_glyph_contours(const RID &p_font_rid, int64_t p_size, int64_t p_index) const {
  669. Dictionary ret;
  670. if (GDVIRTUAL_CALL(font_get_glyph_contours, p_font_rid, p_size, p_index, ret)) {
  671. return ret;
  672. }
  673. return Dictionary();
  674. }
  675. Array TextServerExtension::font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const {
  676. Array ret;
  677. if (GDVIRTUAL_CALL(font_get_kerning_list, p_font_rid, p_size, ret)) {
  678. return ret;
  679. }
  680. return Array();
  681. }
  682. void TextServerExtension::font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) {
  683. GDVIRTUAL_CALL(font_clear_kerning_map, p_font_rid, p_size);
  684. }
  685. void TextServerExtension::font_remove_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) {
  686. GDVIRTUAL_CALL(font_remove_kerning, p_font_rid, p_size, p_glyph_pair);
  687. }
  688. void TextServerExtension::font_set_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) {
  689. GDVIRTUAL_CALL(font_set_kerning, p_font_rid, p_size, p_glyph_pair, p_kerning);
  690. }
  691. Vector2 TextServerExtension::font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const {
  692. Vector2 ret;
  693. if (GDVIRTUAL_CALL(font_get_kerning, p_font_rid, p_size, p_glyph_pair, ret)) {
  694. return ret;
  695. }
  696. return Vector2();
  697. }
  698. int64_t TextServerExtension::font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector) const {
  699. int64_t ret;
  700. if (GDVIRTUAL_CALL(font_get_glyph_index, p_font_rid, p_size, p_char, p_variation_selector, ret)) {
  701. return ret;
  702. }
  703. return 0;
  704. }
  705. bool TextServerExtension::font_has_char(const RID &p_font_rid, int64_t p_char) const {
  706. bool ret;
  707. if (GDVIRTUAL_CALL(font_has_char, p_font_rid, p_char, ret)) {
  708. return ret;
  709. }
  710. return false;
  711. }
  712. String TextServerExtension::font_get_supported_chars(const RID &p_font_rid) const {
  713. String ret;
  714. if (GDVIRTUAL_CALL(font_get_supported_chars, p_font_rid, ret)) {
  715. return ret;
  716. }
  717. return String();
  718. }
  719. void TextServerExtension::font_render_range(const RID &p_font_rid, const Vector2i &p_size, int64_t p_start, int64_t p_end) {
  720. GDVIRTUAL_CALL(font_render_range, p_font_rid, p_size, p_start, p_end);
  721. }
  722. void TextServerExtension::font_render_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_index) {
  723. GDVIRTUAL_CALL(font_render_glyph, p_font_rid, p_size, p_index);
  724. }
  725. void TextServerExtension::font_draw_glyph(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const {
  726. GDVIRTUAL_CALL(font_draw_glyph, p_font_rid, p_canvas, p_size, p_pos, p_index, p_color);
  727. }
  728. void TextServerExtension::font_draw_glyph_outline(const RID &p_font_rid, const RID &p_canvas, int64_t p_size, int64_t p_outline_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const {
  729. GDVIRTUAL_CALL(font_draw_glyph_outline, p_font_rid, p_canvas, p_size, p_outline_size, p_pos, p_index, p_color);
  730. }
  731. bool TextServerExtension::font_is_language_supported(const RID &p_font_rid, const String &p_language) const {
  732. bool ret;
  733. if (GDVIRTUAL_CALL(font_is_language_supported, p_font_rid, p_language, ret)) {
  734. return ret;
  735. }
  736. return false;
  737. }
  738. void TextServerExtension::font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) {
  739. GDVIRTUAL_CALL(font_set_language_support_override, p_font_rid, p_language, p_supported);
  740. }
  741. bool TextServerExtension::font_get_language_support_override(const RID &p_font_rid, const String &p_language) {
  742. bool ret;
  743. if (GDVIRTUAL_CALL(font_get_language_support_override, p_font_rid, p_language, ret)) {
  744. return ret;
  745. }
  746. return false;
  747. }
  748. void TextServerExtension::font_remove_language_support_override(const RID &p_font_rid, const String &p_language) {
  749. GDVIRTUAL_CALL(font_remove_language_support_override, p_font_rid, p_language);
  750. }
  751. PackedStringArray TextServerExtension::font_get_language_support_overrides(const RID &p_font_rid) {
  752. PackedStringArray ret;
  753. if (GDVIRTUAL_CALL(font_get_language_support_overrides, p_font_rid, ret)) {
  754. return ret;
  755. }
  756. return PackedStringArray();
  757. }
  758. bool TextServerExtension::font_is_script_supported(const RID &p_font_rid, const String &p_script) const {
  759. bool ret;
  760. if (GDVIRTUAL_CALL(font_is_script_supported, p_font_rid, p_script, ret)) {
  761. return ret;
  762. }
  763. return false;
  764. }
  765. void TextServerExtension::font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) {
  766. GDVIRTUAL_CALL(font_set_script_support_override, p_font_rid, p_script, p_supported);
  767. }
  768. bool TextServerExtension::font_get_script_support_override(const RID &p_font_rid, const String &p_script) {
  769. bool ret;
  770. if (GDVIRTUAL_CALL(font_get_script_support_override, p_font_rid, p_script, ret)) {
  771. return ret;
  772. }
  773. return false;
  774. }
  775. void TextServerExtension::font_remove_script_support_override(const RID &p_font_rid, const String &p_script) {
  776. GDVIRTUAL_CALL(font_remove_script_support_override, p_font_rid, p_script);
  777. }
  778. PackedStringArray TextServerExtension::font_get_script_support_overrides(const RID &p_font_rid) {
  779. PackedStringArray ret;
  780. if (GDVIRTUAL_CALL(font_get_script_support_overrides, p_font_rid, ret)) {
  781. return ret;
  782. }
  783. return PackedStringArray();
  784. }
  785. void TextServerExtension::font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) {
  786. GDVIRTUAL_CALL(font_set_opentype_feature_overrides, p_font_rid, p_overrides);
  787. }
  788. Dictionary TextServerExtension::font_get_opentype_feature_overrides(const RID &p_font_rid) const {
  789. Dictionary ret;
  790. if (GDVIRTUAL_CALL(font_get_opentype_feature_overrides, p_font_rid, ret)) {
  791. return ret;
  792. }
  793. return Dictionary();
  794. }
  795. Dictionary TextServerExtension::font_supported_feature_list(const RID &p_font_rid) const {
  796. Dictionary ret;
  797. if (GDVIRTUAL_CALL(font_supported_feature_list, p_font_rid, ret)) {
  798. return ret;
  799. }
  800. return Dictionary();
  801. }
  802. Dictionary TextServerExtension::font_supported_variation_list(const RID &p_font_rid) const {
  803. Dictionary ret;
  804. if (GDVIRTUAL_CALL(font_supported_variation_list, p_font_rid, ret)) {
  805. return ret;
  806. }
  807. return Dictionary();
  808. }
  809. double TextServerExtension::font_get_global_oversampling() const {
  810. double ret;
  811. if (GDVIRTUAL_CALL(font_get_global_oversampling, ret)) {
  812. return ret;
  813. }
  814. return 0.0;
  815. }
  816. void TextServerExtension::font_set_global_oversampling(double p_oversampling) {
  817. GDVIRTUAL_CALL(font_set_global_oversampling, p_oversampling);
  818. }
  819. Vector2 TextServerExtension::get_hex_code_box_size(int64_t p_size, int64_t p_index) const {
  820. Vector2 ret;
  821. if (GDVIRTUAL_CALL(get_hex_code_box_size, p_size, p_index, ret)) {
  822. return ret;
  823. }
  824. return TextServer::get_hex_code_box_size(p_size, p_index);
  825. }
  826. void TextServerExtension::draw_hex_code_box(const RID &p_canvas, int64_t p_size, const Vector2 &p_pos, int64_t p_index, const Color &p_color) const {
  827. if (!GDVIRTUAL_CALL(draw_hex_code_box, p_canvas, p_size, p_pos, p_index, p_color)) {
  828. TextServer::draw_hex_code_box(p_canvas, p_size, p_pos, p_index, p_color);
  829. }
  830. }
  831. /*************************************************************************/
  832. /* Shaped text buffer interface */
  833. /*************************************************************************/
  834. RID TextServerExtension::create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) {
  835. RID ret;
  836. if (GDVIRTUAL_CALL(create_shaped_text, p_direction, p_orientation, ret)) {
  837. return ret;
  838. }
  839. return RID();
  840. }
  841. void TextServerExtension::shaped_text_clear(const RID &p_shaped) {
  842. GDVIRTUAL_CALL(shaped_text_clear, p_shaped);
  843. }
  844. void TextServerExtension::shaped_text_set_direction(const RID &p_shaped, TextServer::Direction p_direction) {
  845. GDVIRTUAL_CALL(shaped_text_set_direction, p_shaped, p_direction);
  846. }
  847. TextServer::Direction TextServerExtension::shaped_text_get_direction(const RID &p_shaped) const {
  848. TextServer::Direction ret;
  849. if (GDVIRTUAL_CALL(shaped_text_get_direction, p_shaped, ret)) {
  850. return (TextServer::Direction)ret;
  851. }
  852. return TextServer::Direction::DIRECTION_AUTO;
  853. }
  854. TextServer::Direction TextServerExtension::shaped_text_get_inferred_direction(const RID &p_shaped) const {
  855. TextServer::Direction ret;
  856. if (GDVIRTUAL_CALL(shaped_text_get_inferred_direction, p_shaped, ret)) {
  857. return (TextServer::Direction)ret;
  858. }
  859. return TextServer::Direction::DIRECTION_LTR;
  860. }
  861. void TextServerExtension::shaped_text_set_orientation(const RID &p_shaped, TextServer::Orientation p_orientation) {
  862. GDVIRTUAL_CALL(shaped_text_set_orientation, p_shaped, p_orientation);
  863. }
  864. TextServer::Orientation TextServerExtension::shaped_text_get_orientation(const RID &p_shaped) const {
  865. TextServer::Orientation ret;
  866. if (GDVIRTUAL_CALL(shaped_text_get_orientation, p_shaped, ret)) {
  867. return (TextServer::Orientation)ret;
  868. }
  869. return TextServer::Orientation::ORIENTATION_HORIZONTAL;
  870. }
  871. void TextServerExtension::shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) {
  872. GDVIRTUAL_CALL(shaped_text_set_bidi_override, p_shaped, p_override);
  873. }
  874. void TextServerExtension::shaped_text_set_custom_punctuation(const RID &p_shaped, const String &p_punct) {
  875. GDVIRTUAL_CALL(shaped_text_set_custom_punctuation, p_shaped, p_punct);
  876. }
  877. String TextServerExtension::shaped_text_get_custom_punctuation(const RID &p_shaped) const {
  878. String ret;
  879. if (GDVIRTUAL_CALL(shaped_text_get_custom_punctuation, p_shaped, ret)) {
  880. return ret;
  881. }
  882. return String();
  883. }
  884. void TextServerExtension::shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) {
  885. GDVIRTUAL_CALL(shaped_text_set_preserve_invalid, p_shaped, p_enabled);
  886. }
  887. bool TextServerExtension::shaped_text_get_preserve_invalid(const RID &p_shaped) const {
  888. bool ret;
  889. if (GDVIRTUAL_CALL(shaped_text_get_preserve_invalid, p_shaped, ret)) {
  890. return ret;
  891. }
  892. return false;
  893. }
  894. void TextServerExtension::shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) {
  895. GDVIRTUAL_CALL(shaped_text_set_preserve_control, p_shaped, p_enabled);
  896. }
  897. bool TextServerExtension::shaped_text_get_preserve_control(const RID &p_shaped) const {
  898. bool ret;
  899. if (GDVIRTUAL_CALL(shaped_text_get_preserve_control, p_shaped, ret)) {
  900. return ret;
  901. }
  902. return false;
  903. }
  904. void TextServerExtension::shaped_text_set_spacing(const RID &p_shaped, TextServer::SpacingType p_spacing, int64_t p_value) {
  905. GDVIRTUAL_CALL(shaped_text_set_spacing, p_shaped, p_spacing, p_value);
  906. }
  907. int64_t TextServerExtension::shaped_text_get_spacing(const RID &p_shaped, TextServer::SpacingType p_spacing) const {
  908. int64_t ret;
  909. if (GDVIRTUAL_CALL(shaped_text_get_spacing, p_shaped, p_spacing, ret)) {
  910. return ret;
  911. }
  912. return 0;
  913. }
  914. bool TextServerExtension::shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) {
  915. bool ret;
  916. if (GDVIRTUAL_CALL(shaped_text_add_string, p_shaped, p_text, p_fonts, p_size, p_opentype_features, p_language, p_meta, ret)) {
  917. return ret;
  918. }
  919. return false;
  920. }
  921. bool TextServerExtension::shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length) {
  922. bool ret;
  923. if (GDVIRTUAL_CALL(shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, ret)) {
  924. return ret;
  925. }
  926. return false;
  927. }
  928. bool TextServerExtension::shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align) {
  929. bool ret;
  930. if (GDVIRTUAL_CALL(shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, ret)) {
  931. return ret;
  932. }
  933. return false;
  934. }
  935. int64_t TextServerExtension::shaped_get_span_count(const RID &p_shaped) const {
  936. int64_t ret;
  937. if (GDVIRTUAL_CALL(shaped_get_span_count, p_shaped, ret)) {
  938. return ret;
  939. }
  940. return 0;
  941. }
  942. Variant TextServerExtension::shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const {
  943. Variant ret;
  944. if (GDVIRTUAL_CALL(shaped_get_span_meta, p_shaped, p_index, ret)) {
  945. return ret;
  946. }
  947. return false;
  948. }
  949. void TextServerExtension::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) {
  950. GDVIRTUAL_CALL(shaped_set_span_update_font, p_shaped, p_index, p_fonts, p_size, p_opentype_features);
  951. }
  952. RID TextServerExtension::shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const {
  953. RID ret;
  954. if (GDVIRTUAL_CALL(shaped_text_substr, p_shaped, p_start, p_length, ret)) {
  955. return ret;
  956. }
  957. return RID();
  958. }
  959. RID TextServerExtension::shaped_text_get_parent(const RID &p_shaped) const {
  960. RID ret;
  961. if (GDVIRTUAL_CALL(shaped_text_get_parent, p_shaped, ret)) {
  962. return ret;
  963. }
  964. return RID();
  965. }
  966. double TextServerExtension::shaped_text_fit_to_width(const RID &p_shaped, double p_width, BitField<TextServer::JustificationFlag> p_jst_flags) {
  967. double ret;
  968. if (GDVIRTUAL_CALL(shaped_text_fit_to_width, p_shaped, p_width, p_jst_flags, ret)) {
  969. return ret;
  970. }
  971. return 0.0;
  972. }
  973. double TextServerExtension::shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) {
  974. double ret;
  975. if (GDVIRTUAL_CALL(shaped_text_tab_align, p_shaped, p_tab_stops, ret)) {
  976. return ret;
  977. }
  978. return 0.0;
  979. }
  980. bool TextServerExtension::shaped_text_shape(const RID &p_shaped) {
  981. bool ret;
  982. if (GDVIRTUAL_CALL(shaped_text_shape, p_shaped, ret)) {
  983. return ret;
  984. }
  985. return false;
  986. }
  987. bool TextServerExtension::shaped_text_update_breaks(const RID &p_shaped) {
  988. bool ret;
  989. if (GDVIRTUAL_CALL(shaped_text_update_breaks, p_shaped, ret)) {
  990. return ret;
  991. }
  992. return false;
  993. }
  994. bool TextServerExtension::shaped_text_update_justification_ops(const RID &p_shaped) {
  995. bool ret;
  996. if (GDVIRTUAL_CALL(shaped_text_update_justification_ops, p_shaped, ret)) {
  997. return ret;
  998. }
  999. return false;
  1000. }
  1001. bool TextServerExtension::shaped_text_is_ready(const RID &p_shaped) const {
  1002. bool ret;
  1003. if (GDVIRTUAL_CALL(shaped_text_is_ready, p_shaped, ret)) {
  1004. return ret;
  1005. }
  1006. return false;
  1007. }
  1008. const Glyph *TextServerExtension::shaped_text_get_glyphs(const RID &p_shaped) const {
  1009. GDNativeConstPtr<const Glyph> ret;
  1010. if (GDVIRTUAL_CALL(shaped_text_get_glyphs, p_shaped, ret)) {
  1011. return ret;
  1012. }
  1013. return nullptr;
  1014. }
  1015. const Glyph *TextServerExtension::shaped_text_sort_logical(const RID &p_shaped) {
  1016. GDNativeConstPtr<const Glyph> ret;
  1017. if (GDVIRTUAL_CALL(shaped_text_sort_logical, p_shaped, ret)) {
  1018. return ret;
  1019. }
  1020. return nullptr;
  1021. }
  1022. int64_t TextServerExtension::shaped_text_get_glyph_count(const RID &p_shaped) const {
  1023. int64_t ret;
  1024. if (GDVIRTUAL_CALL(shaped_text_get_glyph_count, p_shaped, ret)) {
  1025. return ret;
  1026. }
  1027. return 0;
  1028. }
  1029. Vector2i TextServerExtension::shaped_text_get_range(const RID &p_shaped) const {
  1030. Vector2i ret;
  1031. if (GDVIRTUAL_CALL(shaped_text_get_range, p_shaped, ret)) {
  1032. return ret;
  1033. }
  1034. return Vector2i();
  1035. }
  1036. PackedInt32Array TextServerExtension::shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start, bool p_once, BitField<TextServer::LineBreakFlag> p_break_flags) const {
  1037. PackedInt32Array ret;
  1038. if (GDVIRTUAL_CALL(shaped_text_get_line_breaks_adv, p_shaped, p_width, p_start, p_once, p_break_flags, ret)) {
  1039. return ret;
  1040. }
  1041. return TextServer::shaped_text_get_line_breaks_adv(p_shaped, p_width, p_start, p_once, p_break_flags);
  1042. }
  1043. PackedInt32Array TextServerExtension::shaped_text_get_line_breaks(const RID &p_shaped, double p_width, int64_t p_start, BitField<TextServer::LineBreakFlag> p_break_flags) const {
  1044. PackedInt32Array ret;
  1045. if (GDVIRTUAL_CALL(shaped_text_get_line_breaks, p_shaped, p_width, p_start, p_break_flags, ret)) {
  1046. return ret;
  1047. }
  1048. return TextServer::shaped_text_get_line_breaks(p_shaped, p_width, p_start, p_break_flags);
  1049. }
  1050. PackedInt32Array TextServerExtension::shaped_text_get_word_breaks(const RID &p_shaped, BitField<TextServer::GraphemeFlag> p_grapheme_flags) const {
  1051. PackedInt32Array ret;
  1052. if (GDVIRTUAL_CALL(shaped_text_get_word_breaks, p_shaped, p_grapheme_flags, ret)) {
  1053. return ret;
  1054. }
  1055. return TextServer::shaped_text_get_word_breaks(p_shaped, p_grapheme_flags);
  1056. }
  1057. int64_t TextServerExtension::shaped_text_get_trim_pos(const RID &p_shaped) const {
  1058. int64_t ret;
  1059. if (GDVIRTUAL_CALL(shaped_text_get_trim_pos, p_shaped, ret)) {
  1060. return ret;
  1061. }
  1062. return -1;
  1063. }
  1064. int64_t TextServerExtension::shaped_text_get_ellipsis_pos(const RID &p_shaped) const {
  1065. int64_t ret;
  1066. if (GDVIRTUAL_CALL(shaped_text_get_ellipsis_pos, p_shaped, ret)) {
  1067. return ret;
  1068. }
  1069. return -1;
  1070. }
  1071. const Glyph *TextServerExtension::shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const {
  1072. GDNativeConstPtr<const Glyph> ret;
  1073. if (GDVIRTUAL_CALL(shaped_text_get_ellipsis_glyphs, p_shaped, ret)) {
  1074. return ret;
  1075. }
  1076. return nullptr;
  1077. }
  1078. int64_t TextServerExtension::shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const {
  1079. int64_t ret;
  1080. if (GDVIRTUAL_CALL(shaped_text_get_ellipsis_glyph_count, p_shaped, ret)) {
  1081. return ret;
  1082. }
  1083. return -1;
  1084. }
  1085. void TextServerExtension::shaped_text_overrun_trim_to_width(const RID &p_shaped_line, double p_width, BitField<TextServer::TextOverrunFlag> p_trim_flags) {
  1086. GDVIRTUAL_CALL(shaped_text_overrun_trim_to_width, p_shaped_line, p_width, p_trim_flags);
  1087. }
  1088. Array TextServerExtension::shaped_text_get_objects(const RID &p_shaped) const {
  1089. Array ret;
  1090. if (GDVIRTUAL_CALL(shaped_text_get_objects, p_shaped, ret)) {
  1091. return ret;
  1092. }
  1093. return Array();
  1094. }
  1095. Rect2 TextServerExtension::shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const {
  1096. Rect2 ret;
  1097. if (GDVIRTUAL_CALL(shaped_text_get_object_rect, p_shaped, p_key, ret)) {
  1098. return ret;
  1099. }
  1100. return Rect2();
  1101. }
  1102. Size2 TextServerExtension::shaped_text_get_size(const RID &p_shaped) const {
  1103. Size2 ret;
  1104. if (GDVIRTUAL_CALL(shaped_text_get_size, p_shaped, ret)) {
  1105. return ret;
  1106. }
  1107. return Size2();
  1108. }
  1109. double TextServerExtension::shaped_text_get_ascent(const RID &p_shaped) const {
  1110. double ret;
  1111. if (GDVIRTUAL_CALL(shaped_text_get_ascent, p_shaped, ret)) {
  1112. return ret;
  1113. }
  1114. return 0.0;
  1115. }
  1116. double TextServerExtension::shaped_text_get_descent(const RID &p_shaped) const {
  1117. double ret;
  1118. if (GDVIRTUAL_CALL(shaped_text_get_descent, p_shaped, ret)) {
  1119. return ret;
  1120. }
  1121. return 0.0;
  1122. }
  1123. double TextServerExtension::shaped_text_get_width(const RID &p_shaped) const {
  1124. double ret;
  1125. if (GDVIRTUAL_CALL(shaped_text_get_width, p_shaped, ret)) {
  1126. return ret;
  1127. }
  1128. return 0.0;
  1129. }
  1130. double TextServerExtension::shaped_text_get_underline_position(const RID &p_shaped) const {
  1131. double ret;
  1132. if (GDVIRTUAL_CALL(shaped_text_get_underline_position, p_shaped, ret)) {
  1133. return ret;
  1134. }
  1135. return 0.0;
  1136. }
  1137. double TextServerExtension::shaped_text_get_underline_thickness(const RID &p_shaped) const {
  1138. double ret;
  1139. if (GDVIRTUAL_CALL(shaped_text_get_underline_thickness, p_shaped, ret)) {
  1140. return ret;
  1141. }
  1142. return 0.0;
  1143. }
  1144. TextServer::Direction TextServerExtension::shaped_text_get_dominant_direction_in_range(const RID &p_shaped, int64_t p_start, int64_t p_end) const {
  1145. int64_t ret;
  1146. if (GDVIRTUAL_CALL(shaped_text_get_dominant_direction_in_range, p_shaped, p_start, p_end, ret)) {
  1147. return (TextServer::Direction)ret;
  1148. }
  1149. return TextServer::shaped_text_get_dominant_direction_in_range(p_shaped, p_start, p_end);
  1150. }
  1151. CaretInfo TextServerExtension::shaped_text_get_carets(const RID &p_shaped, int64_t p_position) const {
  1152. CaretInfo ret;
  1153. if (GDVIRTUAL_CALL(shaped_text_get_carets, p_shaped, p_position, &ret)) {
  1154. return ret;
  1155. }
  1156. return TextServer::shaped_text_get_carets(p_shaped, p_position);
  1157. }
  1158. Vector<Vector2> TextServerExtension::shaped_text_get_selection(const RID &p_shaped, int64_t p_start, int64_t p_end) const {
  1159. Vector<Vector2> ret;
  1160. if (GDVIRTUAL_CALL(shaped_text_get_selection, p_shaped, p_start, p_end, ret)) {
  1161. return ret;
  1162. }
  1163. return TextServer::shaped_text_get_selection(p_shaped, p_start, p_end);
  1164. }
  1165. int64_t TextServerExtension::shaped_text_hit_test_grapheme(const RID &p_shaped, double p_coords) const {
  1166. int64_t ret;
  1167. if (GDVIRTUAL_CALL(shaped_text_hit_test_grapheme, p_shaped, p_coords, ret)) {
  1168. return ret;
  1169. }
  1170. return TextServer::shaped_text_hit_test_grapheme(p_shaped, p_coords);
  1171. }
  1172. int64_t TextServerExtension::shaped_text_hit_test_position(const RID &p_shaped, double p_coords) const {
  1173. int64_t ret;
  1174. if (GDVIRTUAL_CALL(shaped_text_hit_test_position, p_shaped, p_coords, ret)) {
  1175. return ret;
  1176. }
  1177. return TextServer::shaped_text_hit_test_position(p_shaped, p_coords);
  1178. }
  1179. void TextServerExtension::shaped_text_draw(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l, double p_clip_r, const Color &p_color) const {
  1180. if (GDVIRTUAL_CALL(shaped_text_draw, p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_color)) {
  1181. return;
  1182. }
  1183. TextServer::shaped_text_draw(p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_color);
  1184. }
  1185. void TextServerExtension::shaped_text_draw_outline(const RID &p_shaped, const RID &p_canvas, const Vector2 &p_pos, double p_clip_l, double p_clip_r, int64_t p_outline_size, const Color &p_color) const {
  1186. if (GDVIRTUAL_CALL(shaped_text_draw_outline, p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_outline_size, p_color)) {
  1187. return;
  1188. }
  1189. TextServer::shaped_text_draw_outline(p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_outline_size, p_color);
  1190. }
  1191. Vector2 TextServerExtension::shaped_text_get_grapheme_bounds(const RID &p_shaped, int64_t p_pos) const {
  1192. Vector2 ret;
  1193. if (GDVIRTUAL_CALL(shaped_text_get_grapheme_bounds, p_shaped, p_pos, ret)) {
  1194. return ret;
  1195. }
  1196. return TextServer::shaped_text_get_grapheme_bounds(p_shaped, p_pos);
  1197. }
  1198. int64_t TextServerExtension::shaped_text_next_grapheme_pos(const RID &p_shaped, int64_t p_pos) const {
  1199. int64_t ret;
  1200. if (GDVIRTUAL_CALL(shaped_text_next_grapheme_pos, p_shaped, p_pos, ret)) {
  1201. return ret;
  1202. }
  1203. return TextServer::shaped_text_next_grapheme_pos(p_shaped, p_pos);
  1204. }
  1205. int64_t TextServerExtension::shaped_text_prev_grapheme_pos(const RID &p_shaped, int64_t p_pos) const {
  1206. int64_t ret;
  1207. if (GDVIRTUAL_CALL(shaped_text_prev_grapheme_pos, p_shaped, p_pos, ret)) {
  1208. return ret;
  1209. }
  1210. return TextServer::shaped_text_prev_grapheme_pos(p_shaped, p_pos);
  1211. }
  1212. String TextServerExtension::format_number(const String &p_string, const String &p_language) const {
  1213. String ret;
  1214. if (GDVIRTUAL_CALL(format_number, p_string, p_language, ret)) {
  1215. return ret;
  1216. }
  1217. return p_string;
  1218. }
  1219. String TextServerExtension::parse_number(const String &p_string, const String &p_language) const {
  1220. String ret;
  1221. if (GDVIRTUAL_CALL(parse_number, p_string, p_language, ret)) {
  1222. return ret;
  1223. }
  1224. return p_string;
  1225. }
  1226. String TextServerExtension::percent_sign(const String &p_language) const {
  1227. String ret;
  1228. if (GDVIRTUAL_CALL(percent_sign, p_language, ret)) {
  1229. return ret;
  1230. }
  1231. return "%";
  1232. }
  1233. bool TextServerExtension::is_valid_identifier(const String &p_string) const {
  1234. bool ret;
  1235. if (GDVIRTUAL_CALL(is_valid_identifier, p_string, ret)) {
  1236. return ret;
  1237. }
  1238. return TextServer::is_valid_identifier(p_string);
  1239. }
  1240. String TextServerExtension::strip_diacritics(const String &p_string) const {
  1241. String ret;
  1242. if (GDVIRTUAL_CALL(strip_diacritics, p_string, ret)) {
  1243. return ret;
  1244. }
  1245. return TextServer::strip_diacritics(p_string);
  1246. }
  1247. String TextServerExtension::string_to_upper(const String &p_string, const String &p_language) const {
  1248. String ret;
  1249. if (GDVIRTUAL_CALL(string_to_upper, p_string, p_language, ret)) {
  1250. return ret;
  1251. }
  1252. return p_string;
  1253. }
  1254. String TextServerExtension::string_to_lower(const String &p_string, const String &p_language) const {
  1255. String ret;
  1256. if (GDVIRTUAL_CALL(string_to_lower, p_string, p_language, ret)) {
  1257. return ret;
  1258. }
  1259. return p_string;
  1260. }
  1261. Array TextServerExtension::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
  1262. Array ret;
  1263. if (GDVIRTUAL_CALL(parse_structured_text, p_parser_type, p_args, p_text, ret)) {
  1264. return ret;
  1265. }
  1266. return Array();
  1267. }
  1268. PackedInt32Array TextServerExtension::string_get_word_breaks(const String &p_string, const String &p_language) const {
  1269. PackedInt32Array ret;
  1270. if (GDVIRTUAL_CALL(string_get_word_breaks, p_string, p_language, ret)) {
  1271. return ret;
  1272. }
  1273. return PackedInt32Array();
  1274. }
  1275. int TextServerExtension::is_confusable(const String &p_string, const PackedStringArray &p_dict) const {
  1276. int ret;
  1277. if (GDVIRTUAL_CALL(is_confusable, p_string, p_dict, ret)) {
  1278. return ret;
  1279. }
  1280. return TextServer::is_confusable(p_string, p_dict);
  1281. }
  1282. bool TextServerExtension::spoof_check(const String &p_string) const {
  1283. bool ret;
  1284. if (GDVIRTUAL_CALL(spoof_check, p_string, ret)) {
  1285. return ret;
  1286. }
  1287. return TextServer::spoof_check(p_string);
  1288. }
  1289. TextServerExtension::TextServerExtension() {
  1290. //NOP
  1291. }
  1292. TextServerExtension::~TextServerExtension() {
  1293. //NOP
  1294. }