summaryrefslogtreecommitdiff
path: root/servers/text
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2021-11-18 18:55:43 +0300
committerYuri Sizov <yuris@humnom.net>2021-11-22 15:13:13 +0300
commite85e6ec7fcb4d2d542059feb63b18553d1470694 (patch)
tree025df7376d7254da4ce65edeb52b8b783953ac5f /servers/text
parent835f4dedafca255e154dd204e335097c787c363a (diff)
Add methods to get position from column and line in TextEdit
Diffstat (limited to 'servers/text')
-rw-r--r--servers/text/text_server_extension.cpp9
-rw-r--r--servers/text/text_server_extension.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp
index 0a7523e33a..d6d98b4f8f 100644
--- a/servers/text/text_server_extension.cpp
+++ b/servers/text/text_server_extension.cpp
@@ -260,6 +260,7 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(_shaped_text_draw, "shaped", "canvas", "pos", "clip_l", "clip_r", "color");
GDVIRTUAL_BIND(_shaped_text_draw_outline, "shaped", "canvas", "pos", "clip_l", "clip_r", "outline_size", "color");
+ GDVIRTUAL_BIND(_shaped_text_get_grapheme_bounds, "shaped", "pos");
GDVIRTUAL_BIND(_shaped_text_next_grapheme_pos, "shaped", "pos");
GDVIRTUAL_BIND(_shaped_text_prev_grapheme_pos, "shaped", "pos");
@@ -1292,6 +1293,14 @@ void TextServerExtension::shaped_text_draw_outline(RID p_shaped, RID p_canvas, c
shaped_text_draw_outline(p_shaped, p_canvas, p_pos, p_clip_l, p_clip_r, p_outline_size, p_color);
}
+Vector2 TextServerExtension::shaped_text_get_grapheme_bounds(RID p_shaped, int p_pos) const {
+ Vector2 ret;
+ if (GDVIRTUAL_CALL(_shaped_text_get_grapheme_bounds, p_shaped, p_pos, ret)) {
+ return ret;
+ }
+ return TextServer::shaped_text_get_grapheme_bounds(p_shaped, p_pos);
+}
+
int TextServerExtension::shaped_text_next_grapheme_pos(RID p_shaped, int p_pos) const {
int ret;
if (GDVIRTUAL_CALL(_shaped_text_next_grapheme_pos, p_shaped, p_pos, ret)) {
diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h
index e419b4055d..a2dbd25e05 100644
--- a/servers/text/text_server_extension.h
+++ b/servers/text/text_server_extension.h
@@ -428,8 +428,10 @@ public:
GDVIRTUAL6C(_shaped_text_draw, RID, RID, const Vector2 &, float, float, const Color &);
GDVIRTUAL7C(_shaped_text_draw_outline, RID, RID, const Vector2 &, float, float, int, const Color &);
+ virtual Vector2 shaped_text_get_grapheme_bounds(RID p_shaped, int p_pos) const override;
virtual int shaped_text_next_grapheme_pos(RID p_shaped, int p_pos) const override;
virtual int shaped_text_prev_grapheme_pos(RID p_shaped, int p_pos) const override;
+ GDVIRTUAL2RC(Vector2, _shaped_text_get_grapheme_bounds, RID, int);
GDVIRTUAL2RC(int, _shaped_text_next_grapheme_pos, RID, int);
GDVIRTUAL2RC(int, _shaped_text_prev_grapheme_pos, RID, int);