summaryrefslogtreecommitdiff
path: root/servers/text/text_server_extension.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/text/text_server_extension.cpp')
-rw-r--r--servers/text/text_server_extension.cpp105
1 files changed, 88 insertions, 17 deletions
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp
index 5f83fc4206..3c5faa4ef7 100644
--- a/servers/text/text_server_extension.cpp
+++ b/servers/text/text_server_extension.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -174,6 +174,9 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(_font_remove_script_support_override, "font_rid", "script");
GDVIRTUAL_BIND(_font_get_script_support_overrides, "font_rid");
+ GDVIRTUAL_BIND(_font_set_opentype_feature_overrides, "font_rid", "overrides");
+ GDVIRTUAL_BIND(_font_get_opentype_feature_overrides, "font_rid");
+
GDVIRTUAL_BIND(_font_supported_feature_list, "font_rid");
GDVIRTUAL_BIND(_font_supported_variation_list, "font_rid");
@@ -191,6 +194,7 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(_shaped_text_set_direction, "shaped", "direction");
GDVIRTUAL_BIND(_shaped_text_get_direction, "shaped");
+ GDVIRTUAL_BIND(_shaped_text_get_inferred_direction, "shaped");
GDVIRTUAL_BIND(_shaped_text_set_bidi_override, "shaped", "override");
@@ -206,10 +210,14 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(_shaped_text_set_preserve_control, "shaped", "enabled");
GDVIRTUAL_BIND(_shaped_text_get_preserve_control, "shaped");
- GDVIRTUAL_BIND(_shaped_text_add_string, "shaped", "text", "fonts", "size", "opentype_features", "language");
+ GDVIRTUAL_BIND(_shaped_text_add_string, "shaped", "text", "fonts", "size", "opentype_features", "language", "meta");
GDVIRTUAL_BIND(_shaped_text_add_object, "shaped", "key", "size", "inline_align", "length");
GDVIRTUAL_BIND(_shaped_text_resize_object, "shaped", "key", "size", "inline_align");
+ GDVIRTUAL_BIND(_shaped_get_span_count, "shaped");
+ GDVIRTUAL_BIND(_shaped_get_span_meta, "shaped", "index");
+ GDVIRTUAL_BIND(_shaped_set_span_update_font, "shaped", "index", "fonts", "size", "opentype_features");
+
GDVIRTUAL_BIND(_shaped_text_substr, "shaped", "start", "length");
GDVIRTUAL_BIND(_shaped_text_get_parent, "shaped");
@@ -222,8 +230,8 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(_shaped_text_is_ready, "shaped");
- GDVIRTUAL_BIND(_shaped_text_get_glyphs, "shaped", "r_glyphs");
- GDVIRTUAL_BIND(_shaped_text_sort_logical, "shaped", "r_glyphs");
+ GDVIRTUAL_BIND(_shaped_text_get_glyphs, "shaped");
+ GDVIRTUAL_BIND(_shaped_text_sort_logical, "shaped");
GDVIRTUAL_BIND(_shaped_text_get_glyph_count, "shaped");
GDVIRTUAL_BIND(_shaped_text_get_range, "shaped");
@@ -235,7 +243,7 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(_shaped_text_get_trim_pos, "shaped");
GDVIRTUAL_BIND(_shaped_text_get_ellipsis_pos, "shaped");
GDVIRTUAL_BIND(_shaped_text_get_ellipsis_glyph_count, "shaped");
- GDVIRTUAL_BIND(_shaped_text_get_ellipsis_glyphs, "shaped", "r_glyphs");
+ GDVIRTUAL_BIND(_shaped_text_get_ellipsis_glyphs, "shaped");
GDVIRTUAL_BIND(_shaped_text_overrun_trim_to_width, "shaped", "width", "trim_flags");
@@ -267,6 +275,9 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(_format_number, "string", "language");
GDVIRTUAL_BIND(_parse_number, "string", "language");
GDVIRTUAL_BIND(_percent_sign, "language");
+
+ GDVIRTUAL_BIND(_string_to_upper, "string", "language");
+ GDVIRTUAL_BIND(_string_to_lower, "string", "language");
}
bool TextServerExtension::has_feature(Feature p_feature) const {
@@ -494,7 +505,7 @@ void TextServerExtension::font_set_hinting(RID p_font_rid, TextServer::Hinting p
}
TextServer::Hinting TextServerExtension::font_get_hinting(RID p_font_rid) const {
- int ret;
+ TextServer::Hinting ret;
if (GDVIRTUAL_CALL(_font_get_hinting, p_font_rid, ret)) {
return (TextServer::Hinting)ret;
}
@@ -869,6 +880,18 @@ Vector<String> TextServerExtension::font_get_script_support_overrides(RID p_font
return Vector<String>();
}
+void TextServerExtension::font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) {
+ GDVIRTUAL_CALL(_font_set_opentype_feature_overrides, p_font_rid, p_overrides);
+}
+
+Dictionary TextServerExtension::font_get_opentype_feature_overrides(RID p_font_rid) const {
+ Dictionary ret;
+ if (GDVIRTUAL_CALL(_font_get_opentype_feature_overrides, p_font_rid, ret)) {
+ return ret;
+ }
+ return Dictionary();
+}
+
Dictionary TextServerExtension::font_supported_feature_list(RID p_font_rid) const {
Dictionary ret;
if (GDVIRTUAL_CALL(_font_supported_feature_list, p_font_rid, ret)) {
@@ -932,19 +955,27 @@ void TextServerExtension::shaped_text_set_direction(RID p_shaped, TextServer::Di
}
TextServer::Direction TextServerExtension::shaped_text_get_direction(RID p_shaped) const {
- int ret;
+ TextServer::Direction ret;
if (GDVIRTUAL_CALL(_shaped_text_get_direction, p_shaped, ret)) {
return (TextServer::Direction)ret;
}
return TextServer::Direction::DIRECTION_AUTO;
}
+TextServer::Direction TextServerExtension::shaped_text_get_inferred_direction(RID p_shaped) const {
+ TextServer::Direction ret;
+ if (GDVIRTUAL_CALL(_shaped_text_get_inferred_direction, p_shaped, ret)) {
+ return (TextServer::Direction)ret;
+ }
+ return TextServer::Direction::DIRECTION_LTR;
+}
+
void TextServerExtension::shaped_text_set_orientation(RID p_shaped, TextServer::Orientation p_orientation) {
GDVIRTUAL_CALL(_shaped_text_set_orientation, p_shaped, p_orientation);
}
TextServer::Orientation TextServerExtension::shaped_text_get_orientation(RID p_shaped) const {
- int ret;
+ TextServer::Orientation ret;
if (GDVIRTUAL_CALL(_shaped_text_get_orientation, p_shaped, ret)) {
return (TextServer::Orientation)ret;
}
@@ -991,13 +1022,13 @@ bool TextServerExtension::shaped_text_get_preserve_control(RID p_shaped) const {
return false;
}
-bool TextServerExtension::shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language) {
+bool TextServerExtension::shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) {
bool ret;
Array fonts;
for (int i = 0; i < p_fonts.size(); i++) {
fonts.push_back(p_fonts[i]);
}
- if (GDVIRTUAL_CALL(_shaped_text_add_string, p_shaped, p_text, fonts, p_size, p_opentype_features, p_language, ret)) {
+ if (GDVIRTUAL_CALL(_shaped_text_add_string, p_shaped, p_text, fonts, p_size, p_opentype_features, p_language, p_meta, ret)) {
return ret;
}
return false;
@@ -1019,6 +1050,30 @@ bool TextServerExtension::shaped_text_resize_object(RID p_shaped, Variant p_key,
return false;
}
+int TextServerExtension::shaped_get_span_count(RID p_shaped) const {
+ int ret;
+ if (GDVIRTUAL_CALL(_shaped_get_span_count, p_shaped, ret)) {
+ return ret;
+ }
+ return 0;
+}
+
+Variant TextServerExtension::shaped_get_span_meta(RID p_shaped, int p_index) const {
+ Variant ret;
+ if (GDVIRTUAL_CALL(_shaped_get_span_meta, p_shaped, p_index, ret)) {
+ return ret;
+ }
+ return false;
+}
+
+void TextServerExtension::shaped_set_span_update_font(RID p_shaped, int p_index, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features) {
+ Array fonts;
+ for (int i = 0; i < p_fonts.size(); i++) {
+ fonts.push_back(p_fonts[i]);
+ }
+ GDVIRTUAL_CALL(_shaped_set_span_update_font, p_shaped, p_index, fonts, p_size, p_opentype_features);
+}
+
RID TextServerExtension::shaped_text_substr(RID p_shaped, int p_start, int p_length) const {
RID ret;
if (GDVIRTUAL_CALL(_shaped_text_substr, p_shaped, p_start, p_length, ret)) {
@@ -1084,16 +1139,16 @@ bool TextServerExtension::shaped_text_is_ready(RID p_shaped) const {
}
const Glyph *TextServerExtension::shaped_text_get_glyphs(RID p_shaped) const {
- const Glyph *ret;
- if (GDVIRTUAL_CALL(_shaped_text_get_glyphs, p_shaped, &ret)) {
+ GDNativePtr<Glyph> ret;
+ if (GDVIRTUAL_CALL(_shaped_text_get_glyphs, p_shaped, ret)) {
return ret;
}
return nullptr;
}
const Glyph *TextServerExtension::shaped_text_sort_logical(RID p_shaped) {
- const Glyph *ret;
- if (GDVIRTUAL_CALL(_shaped_text_sort_logical, p_shaped, &ret)) {
+ GDNativePtr<Glyph> ret;
+ if (GDVIRTUAL_CALL(_shaped_text_sort_logical, p_shaped, ret)) {
return ret;
}
return nullptr;
@@ -1156,8 +1211,8 @@ int TextServerExtension::shaped_text_get_ellipsis_pos(RID p_shaped) const {
}
const Glyph *TextServerExtension::shaped_text_get_ellipsis_glyphs(RID p_shaped) const {
- const Glyph *ret;
- if (GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyphs, p_shaped, &ret)) {
+ GDNativePtr<Glyph> ret;
+ if (GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyphs, p_shaped, ret)) {
return ret;
}
return nullptr;
@@ -1341,6 +1396,22 @@ String TextServerExtension::percent_sign(const String &p_language) const {
return TextServer::percent_sign(p_language);
}
+String TextServerExtension::string_to_upper(const String &p_string, const String &p_language) const {
+ String ret;
+ if (GDVIRTUAL_CALL(_string_to_upper, p_string, p_language, ret)) {
+ return ret;
+ }
+ return p_string;
+}
+
+String TextServerExtension::string_to_lower(const String &p_string, const String &p_language) const {
+ String ret;
+ if (GDVIRTUAL_CALL(_string_to_lower, p_string, p_language, ret)) {
+ return ret;
+ }
+ return p_string;
+}
+
TextServerExtension::TextServerExtension() {
//NOP
}