diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-02-22 12:10:37 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-03-13 12:57:39 +0200 |
commit | 3bb5047db3add0e7fcf11bc8a3fc36a8e9df6d5d (patch) | |
tree | 782a2b7ca300c06a24c04b53486f5c5f17398551 /servers/text | |
parent | 61282068f4d59cb48f35ad95391728c58d9008ab (diff) | |
download | redot-engine-3bb5047db3add0e7fcf11bc8a3fc36a8e9df6d5d.tar.gz |
[TextServer] Use GDVIRTUAL_REQUIRED_CALL for required extensions methods, update extension docs.
Diffstat (limited to 'servers/text')
-rw-r--r-- | servers/text/text_server_dummy.h | 84 | ||||
-rw-r--r-- | servers/text/text_server_extension.cpp | 182 |
2 files changed, 175 insertions, 91 deletions
diff --git a/servers/text/text_server_dummy.h b/servers/text/text_server_dummy.h index 77b6ecf319..a5ab444f55 100644 --- a/servers/text/text_server_dummy.h +++ b/servers/text/text_server_dummy.h @@ -40,9 +40,87 @@ class TextServerDummy : public TextServerExtension { _THREAD_SAFE_CLASS_ public: - virtual String get_name() const override { - return "Dummy"; - } + virtual bool has_feature(Feature p_feature) const override { return false; } + virtual String get_name() const override { return "Dummy"; } + virtual int64_t get_features() const override { return 0; } + virtual void free_rid(const RID &p_rid) override {} + virtual bool has(const RID &p_rid) override { return false; } + + virtual RID create_font() override { return RID(); } + virtual void font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) override {} + virtual int64_t font_get_fixed_size(const RID &p_font_rid) const override { return 0; } + virtual void font_set_fixed_size_scale_mode(const RID &p_font_rid, TextServer::FixedSizeScaleMode p_fixed_size_scale_mode) override {} + virtual TextServer::FixedSizeScaleMode font_get_fixed_size_scale_mode(const RID &p_font_rid) const override { return FIXED_SIZE_SCALE_DISABLE; } + virtual TypedArray<Vector2i> font_get_size_cache_list(const RID &p_font_rid) const override { return TypedArray<Vector2i>(); } + virtual void font_clear_size_cache(const RID &p_font_rid) override {} + virtual void font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) override {} + virtual void font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) override {} + virtual double font_get_ascent(const RID &p_font_rid, int64_t p_size) const override { return 0; } + virtual void font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) override {} + virtual double font_get_descent(const RID &p_font_rid, int64_t p_size) const override { return 0; } + virtual void font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) override {} + virtual double font_get_underline_position(const RID &p_font_rid, int64_t p_size) const override { return 0; } + virtual void font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) override {} + virtual double font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const override { return 0; } + virtual void font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) override {} + virtual double font_get_scale(const RID &p_font_rid, int64_t p_size) const override { return 0; } + virtual int64_t font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const override { return 0; } + virtual void font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) override {} + virtual void font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) override {} + virtual void font_set_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const Ref<Image> &p_image) override {} + virtual Ref<Image> font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const override { return Ref<Image>(); } + virtual PackedInt32Array font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const override { return PackedInt32Array(); } + virtual void font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) override {} + virtual void font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) override {} + virtual Vector2 font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const override { return Vector2(); } + virtual void font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) override {} + virtual Vector2 font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Vector2(); } + virtual void font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) override {} + virtual Vector2 font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Vector2(); } + virtual void font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) override {} + virtual Rect2 font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Rect2(); } + virtual void font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) override {} + virtual int64_t font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return 0; } + virtual void font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) override {} + virtual RID font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return RID(); } + virtual Size2 font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override { return Size2(); } + virtual int64_t font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector) const override { return 0; } + virtual int64_t font_get_char_from_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_glyph_index) const override { return 0; } + virtual bool font_has_char(const RID &p_font_rid, int64_t p_char) const override { return false; } + virtual String font_get_supported_chars(const RID &p_font_rid) const override { return String(); } + virtual void 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 override {} + virtual void 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 override {} + + virtual RID create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) override { return RID(); } + virtual void shaped_text_clear(const RID &p_shaped) override {} + virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) override { return false; } + virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, double p_baseline) override { return false; } + virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) override { return false; } + virtual int64_t shaped_get_span_count(const RID &p_shaped) const override { return 0; } + virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const override { return Variant(); } + virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) override {} + virtual RID shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const override { return RID(); } + virtual RID shaped_text_get_parent(const RID &p_shaped) const override { return RID(); } + virtual bool shaped_text_shape(const RID &p_shaped) override { return false; } + virtual bool shaped_text_is_ready(const RID &p_shaped) const override { return false; } + virtual const Glyph *shaped_text_get_glyphs(const RID &p_shaped) const override { return nullptr; } + virtual const Glyph *shaped_text_sort_logical(const RID &p_shaped) override { return nullptr; } + virtual int64_t shaped_text_get_glyph_count(const RID &p_shaped) const override { return 0; } + virtual Vector2i shaped_text_get_range(const RID &p_shaped) const override { return Vector2i(); } + virtual int64_t shaped_text_get_trim_pos(const RID &p_shaped) const override { return -1; } + virtual int64_t shaped_text_get_ellipsis_pos(const RID &p_shaped) const override { return -1; } + virtual const Glyph *shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const override { return nullptr; } + virtual int64_t shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const override { return -1; } + virtual Array shaped_text_get_objects(const RID &p_shaped) const override { return Array(); } + virtual Rect2 shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const override { return Rect2(); } + virtual Vector2i shaped_text_get_object_range(const RID &p_shaped, const Variant &p_key) const override { return Vector2i(); } + virtual int64_t shaped_text_get_object_glyph(const RID &p_shaped, const Variant &p_key) const override { return -1; } + virtual Size2 shaped_text_get_size(const RID &p_shaped) const override { return Size2(); } + virtual double shaped_text_get_ascent(const RID &p_shaped) const override { return 0; } + virtual double shaped_text_get_descent(const RID &p_shaped) const override { return 0; } + virtual double shaped_text_get_width(const RID &p_shaped) const override { return 0; } + virtual double shaped_text_get_underline_position(const RID &p_shaped) const override { return 0; } + virtual double shaped_text_get_underline_thickness(const RID &p_shaped) const override { return 0; } }; #endif // TEXT_SERVER_DUMMY_H diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index 113972d20d..eb9f1c1484 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -326,8 +326,8 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(_shaped_text_prev_character_pos, "shaped", "pos"); GDVIRTUAL_BIND(_shaped_text_closest_character_pos, "shaped", "pos"); - GDVIRTUAL_BIND(_format_number, "string", "language"); - GDVIRTUAL_BIND(_parse_number, "string", "language"); + GDVIRTUAL_BIND(_format_number, "number", "language"); + GDVIRTUAL_BIND(_parse_number, "number", "language"); GDVIRTUAL_BIND(_percent_sign, "language"); GDVIRTUAL_BIND(_strip_diacritics, "string"); @@ -349,29 +349,29 @@ void TextServerExtension::_bind_methods() { bool TextServerExtension::has_feature(Feature p_feature) const { bool ret = false; - GDVIRTUAL_CALL(_has_feature, p_feature, ret); + GDVIRTUAL_REQUIRED_CALL(_has_feature, p_feature, ret); return ret; } String TextServerExtension::get_name() const { String ret = "Unknown"; - GDVIRTUAL_CALL(_get_name, ret); + GDVIRTUAL_REQUIRED_CALL(_get_name, ret); return ret; } int64_t TextServerExtension::get_features() const { int64_t ret = 0; - GDVIRTUAL_CALL(_get_features, ret); + GDVIRTUAL_REQUIRED_CALL(_get_features, ret); return ret; } void TextServerExtension::free_rid(const RID &p_rid) { - GDVIRTUAL_CALL(_free_rid, p_rid); + GDVIRTUAL_REQUIRED_CALL(_free_rid, p_rid); } bool TextServerExtension::has(const RID &p_rid) { bool ret = false; - GDVIRTUAL_CALL(_has, p_rid, ret); + GDVIRTUAL_REQUIRED_CALL(_has, p_rid, ret); return ret; } @@ -407,14 +407,18 @@ bool TextServerExtension::is_locale_right_to_left(const String &p_locale) const int64_t TextServerExtension::name_to_tag(const String &p_name) const { int64_t ret = 0; - GDVIRTUAL_CALL(_name_to_tag, p_name, ret); - return ret; + if (GDVIRTUAL_CALL(_name_to_tag, p_name, ret)) { + return ret; + } + return TextServer::name_to_tag(p_name); } String TextServerExtension::tag_to_name(int64_t p_tag) const { String ret; - GDVIRTUAL_CALL(_tag_to_name, p_tag, ret); - return ret; + if (GDVIRTUAL_CALL(_tag_to_name, p_tag, ret)) { + return ret; + } + return TextServer::tag_to_name(p_tag); } /*************************************************************************/ @@ -423,7 +427,7 @@ String TextServerExtension::tag_to_name(int64_t p_tag) const { RID TextServerExtension::create_font() { RID ret; - GDVIRTUAL_CALL(_create_font, ret); + GDVIRTUAL_REQUIRED_CALL(_create_font, ret); return ret; } @@ -452,7 +456,7 @@ int64_t TextServerExtension::font_get_face_index(const RID &p_font_rid) const { } int64_t TextServerExtension::font_get_face_count(const RID &p_font_rid) const { - int64_t ret = 0; + int64_t ret = 1; GDVIRTUAL_CALL(_font_get_face_count, p_font_rid, ret); return ret; } @@ -574,22 +578,22 @@ int64_t TextServerExtension::font_get_msdf_size(const RID &p_font_rid) const { } void TextServerExtension::font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) { - GDVIRTUAL_CALL(_font_set_fixed_size, p_font_rid, p_fixed_size); + GDVIRTUAL_REQUIRED_CALL(_font_set_fixed_size, p_font_rid, p_fixed_size); } int64_t TextServerExtension::font_get_fixed_size(const RID &p_font_rid) const { int64_t ret = 0; - GDVIRTUAL_CALL(_font_get_fixed_size, p_font_rid, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_fixed_size, p_font_rid, ret); return ret; } void TextServerExtension::font_set_fixed_size_scale_mode(const RID &p_font_rid, TextServer::FixedSizeScaleMode p_fixed_size_scale_mode) { - GDVIRTUAL_CALL(_font_set_fixed_size_scale_mode, p_font_rid, p_fixed_size_scale_mode); + GDVIRTUAL_REQUIRED_CALL(_font_set_fixed_size_scale_mode, p_font_rid, p_fixed_size_scale_mode); } TextServer::FixedSizeScaleMode TextServerExtension::font_get_fixed_size_scale_mode(const RID &p_font_rid) const { FixedSizeScaleMode ret = FIXED_SIZE_SCALE_DISABLE; - GDVIRTUAL_CALL(_font_get_fixed_size_scale_mode, p_font_rid, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_fixed_size_scale_mode, p_font_rid, ret); return ret; } @@ -695,89 +699,89 @@ double TextServerExtension::font_get_oversampling(const RID &p_font_rid) const { TypedArray<Vector2i> TextServerExtension::font_get_size_cache_list(const RID &p_font_rid) const { TypedArray<Vector2i> ret; - GDVIRTUAL_CALL(_font_get_size_cache_list, p_font_rid, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_size_cache_list, p_font_rid, ret); return ret; } void TextServerExtension::font_clear_size_cache(const RID &p_font_rid) { - GDVIRTUAL_CALL(_font_clear_size_cache, p_font_rid); + GDVIRTUAL_REQUIRED_CALL(_font_clear_size_cache, p_font_rid); } void TextServerExtension::font_remove_size_cache(const RID &p_font_rid, const Vector2i &p_size) { - GDVIRTUAL_CALL(_font_remove_size_cache, p_font_rid, p_size); + GDVIRTUAL_REQUIRED_CALL(_font_remove_size_cache, p_font_rid, p_size); } void TextServerExtension::font_set_ascent(const RID &p_font_rid, int64_t p_size, double p_ascent) { - GDVIRTUAL_CALL(_font_set_ascent, p_font_rid, p_size, p_ascent); + GDVIRTUAL_REQUIRED_CALL(_font_set_ascent, p_font_rid, p_size, p_ascent); } double TextServerExtension::font_get_ascent(const RID &p_font_rid, int64_t p_size) const { double ret = 0; - GDVIRTUAL_CALL(_font_get_ascent, p_font_rid, p_size, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_ascent, p_font_rid, p_size, ret); return ret; } void TextServerExtension::font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) { - GDVIRTUAL_CALL(_font_set_descent, p_font_rid, p_size, p_descent); + GDVIRTUAL_REQUIRED_CALL(_font_set_descent, p_font_rid, p_size, p_descent); } double TextServerExtension::font_get_descent(const RID &p_font_rid, int64_t p_size) const { double ret = 0; - GDVIRTUAL_CALL(_font_get_descent, p_font_rid, p_size, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_descent, p_font_rid, p_size, ret); return ret; } void TextServerExtension::font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) { - GDVIRTUAL_CALL(_font_set_underline_position, p_font_rid, p_size, p_underline_position); + GDVIRTUAL_REQUIRED_CALL(_font_set_underline_position, p_font_rid, p_size, p_underline_position); } double TextServerExtension::font_get_underline_position(const RID &p_font_rid, int64_t p_size) const { double ret = 0; - GDVIRTUAL_CALL(_font_get_underline_position, p_font_rid, p_size, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_underline_position, p_font_rid, p_size, ret); return ret; } void TextServerExtension::font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) { - GDVIRTUAL_CALL(_font_set_underline_thickness, p_font_rid, p_size, p_underline_thickness); + GDVIRTUAL_REQUIRED_CALL(_font_set_underline_thickness, p_font_rid, p_size, p_underline_thickness); } double TextServerExtension::font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const { double ret = 0; - GDVIRTUAL_CALL(_font_get_underline_thickness, p_font_rid, p_size, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_underline_thickness, p_font_rid, p_size, ret); return ret; } void TextServerExtension::font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) { - GDVIRTUAL_CALL(_font_set_scale, p_font_rid, p_size, p_scale); + GDVIRTUAL_REQUIRED_CALL(_font_set_scale, p_font_rid, p_size, p_scale); } double TextServerExtension::font_get_scale(const RID &p_font_rid, int64_t p_size) const { double ret = 0; - GDVIRTUAL_CALL(_font_get_scale, p_font_rid, p_size, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_scale, p_font_rid, p_size, ret); return ret; } int64_t TextServerExtension::font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const { int64_t ret = 0; - GDVIRTUAL_CALL(_font_get_texture_count, p_font_rid, p_size, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_texture_count, p_font_rid, p_size, ret); return ret; } void TextServerExtension::font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) { - GDVIRTUAL_CALL(_font_clear_textures, p_font_rid, p_size); + GDVIRTUAL_REQUIRED_CALL(_font_clear_textures, p_font_rid, p_size); } void TextServerExtension::font_remove_texture(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) { - GDVIRTUAL_CALL(_font_remove_texture, p_font_rid, p_size, p_texture_index); + GDVIRTUAL_REQUIRED_CALL(_font_remove_texture, p_font_rid, p_size, p_texture_index); } 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) { - GDVIRTUAL_CALL(_font_set_texture_image, p_font_rid, p_size, p_texture_index, p_image); + GDVIRTUAL_REQUIRED_CALL(_font_set_texture_image, p_font_rid, p_size, p_texture_index, p_image); } Ref<Image> TextServerExtension::font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { Ref<Image> ret; - GDVIRTUAL_CALL(_font_get_texture_image, p_font_rid, p_size, p_texture_index, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_texture_image, p_font_rid, p_size, p_texture_index, ret); return ret; } @@ -793,77 +797,77 @@ PackedInt32Array TextServerExtension::font_get_texture_offsets(const RID &p_font PackedInt32Array TextServerExtension::font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const { PackedInt32Array ret; - GDVIRTUAL_CALL(_font_get_glyph_list, p_font_rid, p_size, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_list, p_font_rid, p_size, ret); return ret; } void TextServerExtension::font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) { - GDVIRTUAL_CALL(_font_clear_glyphs, p_font_rid, p_size); + GDVIRTUAL_REQUIRED_CALL(_font_clear_glyphs, p_font_rid, p_size); } void TextServerExtension::font_remove_glyph(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) { - GDVIRTUAL_CALL(_font_remove_glyph, p_font_rid, p_size, p_glyph); + GDVIRTUAL_REQUIRED_CALL(_font_remove_glyph, p_font_rid, p_size, p_glyph); } Vector2 TextServerExtension::font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const { Vector2 ret; - GDVIRTUAL_CALL(_font_get_glyph_advance, p_font_rid, p_size, p_glyph, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_advance, p_font_rid, p_size, p_glyph, ret); return ret; } void TextServerExtension::font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) { - GDVIRTUAL_CALL(_font_set_glyph_advance, p_font_rid, p_size, p_glyph, p_advance); + GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_advance, p_font_rid, p_size, p_glyph, p_advance); } Vector2 TextServerExtension::font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Vector2 ret; - GDVIRTUAL_CALL(_font_get_glyph_offset, p_font_rid, p_size, p_glyph, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_offset, p_font_rid, p_size, p_glyph, ret); return ret; } void TextServerExtension::font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) { - GDVIRTUAL_CALL(_font_set_glyph_offset, p_font_rid, p_size, p_glyph, p_offset); + GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_offset, p_font_rid, p_size, p_glyph, p_offset); } Vector2 TextServerExtension::font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Vector2 ret; - GDVIRTUAL_CALL(_font_get_glyph_size, p_font_rid, p_size, p_glyph, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_size, p_font_rid, p_size, p_glyph, ret); return ret; } void TextServerExtension::font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) { - GDVIRTUAL_CALL(_font_set_glyph_size, p_font_rid, p_size, p_glyph, p_gl_size); + GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_size, p_font_rid, p_size, p_glyph, p_gl_size); } Rect2 TextServerExtension::font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Rect2 ret; - GDVIRTUAL_CALL(_font_get_glyph_uv_rect, p_font_rid, p_size, p_glyph, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_uv_rect, p_font_rid, p_size, p_glyph, ret); return ret; } 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) { - GDVIRTUAL_CALL(_font_set_glyph_uv_rect, p_font_rid, p_size, p_glyph, p_uv_rect); + GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_uv_rect, p_font_rid, p_size, p_glyph, p_uv_rect); } int64_t TextServerExtension::font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { int64_t ret = 0; - GDVIRTUAL_CALL(_font_get_glyph_texture_idx, p_font_rid, p_size, p_glyph, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_texture_idx, p_font_rid, p_size, p_glyph, ret); return ret; } 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) { - GDVIRTUAL_CALL(_font_set_glyph_texture_idx, p_font_rid, p_size, p_glyph, p_texture_idx); + GDVIRTUAL_REQUIRED_CALL(_font_set_glyph_texture_idx, p_font_rid, p_size, p_glyph, p_texture_idx); } RID TextServerExtension::font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { RID ret; - GDVIRTUAL_CALL(_font_get_glyph_texture_rid, p_font_rid, p_size, p_glyph, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_texture_rid, p_font_rid, p_size, p_glyph, ret); return ret; } Size2 TextServerExtension::font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Size2 ret; - GDVIRTUAL_CALL(_font_get_glyph_texture_size, p_font_rid, p_size, p_glyph, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_texture_size, p_font_rid, p_size, p_glyph, ret); return ret; } @@ -899,25 +903,25 @@ Vector2 TextServerExtension::font_get_kerning(const RID &p_font_rid, int64_t p_s 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 { int64_t ret = 0; - GDVIRTUAL_CALL(_font_get_glyph_index, p_font_rid, p_size, p_char, p_variation_selector, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_glyph_index, p_font_rid, p_size, p_char, p_variation_selector, ret); return ret; } int64_t TextServerExtension::font_get_char_from_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_glyph_index) const { int64_t ret = 0; - GDVIRTUAL_CALL(_font_get_char_from_glyph_index, p_font_rid, p_size, p_glyph_index, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_char_from_glyph_index, p_font_rid, p_size, p_glyph_index, ret); return ret; } bool TextServerExtension::font_has_char(const RID &p_font_rid, int64_t p_char) const { bool ret = false; - GDVIRTUAL_CALL(_font_has_char, p_font_rid, p_char, ret); + GDVIRTUAL_REQUIRED_CALL(_font_has_char, p_font_rid, p_char, ret); return ret; } String TextServerExtension::font_get_supported_chars(const RID &p_font_rid) const { String ret; - GDVIRTUAL_CALL(_font_get_supported_chars, p_font_rid, ret); + GDVIRTUAL_REQUIRED_CALL(_font_get_supported_chars, p_font_rid, ret); return ret; } @@ -930,11 +934,11 @@ void TextServerExtension::font_render_glyph(const RID &p_font_rid, const Vector2 } 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 { - GDVIRTUAL_CALL(_font_draw_glyph, p_font_rid, p_canvas, p_size, p_pos, p_index, p_color); + GDVIRTUAL_REQUIRED_CALL(_font_draw_glyph, p_font_rid, p_canvas, p_size, p_pos, p_index, p_color); } 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 { - GDVIRTUAL_CALL(_font_draw_glyph_outline, p_font_rid, p_canvas, p_size, p_outline_size, p_pos, p_index, p_color); + GDVIRTUAL_REQUIRED_CALL(_font_draw_glyph_outline, p_font_rid, p_canvas, p_size, p_outline_size, p_pos, p_index, p_color); } bool TextServerExtension::font_is_language_supported(const RID &p_font_rid, const String &p_language) const { @@ -1041,12 +1045,12 @@ void TextServerExtension::draw_hex_code_box(const RID &p_canvas, int64_t p_size, RID TextServerExtension::create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) { RID ret; - GDVIRTUAL_CALL(_create_shaped_text, p_direction, p_orientation, ret); + GDVIRTUAL_REQUIRED_CALL(_create_shaped_text, p_direction, p_orientation, ret); return ret; } void TextServerExtension::shaped_text_clear(const RID &p_shaped) { - GDVIRTUAL_CALL(_shaped_text_clear, p_shaped); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_clear, p_shaped); } void TextServerExtension::shaped_text_set_direction(const RID &p_shaped, TextServer::Direction p_direction) { @@ -1131,47 +1135,47 @@ int64_t TextServerExtension::shaped_text_get_spacing(const RID &p_shaped, TextSe bool TextServerExtension::shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { bool ret = false; - GDVIRTUAL_CALL(_shaped_text_add_string, p_shaped, p_text, p_fonts, p_size, p_opentype_features, p_language, p_meta, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_add_string, p_shaped, p_text, p_fonts, p_size, p_opentype_features, p_language, p_meta, ret); return ret; } 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, double p_baseline) { bool ret = false; - GDVIRTUAL_CALL(_shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, p_baseline, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, p_baseline, ret); return ret; } bool TextServerExtension::shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) { bool ret = false; - GDVIRTUAL_CALL(_shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, p_baseline, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, p_baseline, ret); return ret; } int64_t TextServerExtension::shaped_get_span_count(const RID &p_shaped) const { int64_t ret = 0; - GDVIRTUAL_CALL(_shaped_get_span_count, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_get_span_count, p_shaped, ret); return ret; } Variant TextServerExtension::shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const { Variant ret = false; - GDVIRTUAL_CALL(_shaped_get_span_meta, p_shaped, p_index, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_get_span_meta, p_shaped, p_index, ret); return ret; } void TextServerExtension::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { - GDVIRTUAL_CALL(_shaped_set_span_update_font, p_shaped, p_index, p_fonts, p_size, p_opentype_features); + GDVIRTUAL_REQUIRED_CALL(_shaped_set_span_update_font, p_shaped, p_index, p_fonts, p_size, p_opentype_features); } RID TextServerExtension::shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const { RID ret; - GDVIRTUAL_CALL(_shaped_text_substr, p_shaped, p_start, p_length, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_substr, p_shaped, p_start, p_length, ret); return ret; } RID TextServerExtension::shaped_text_get_parent(const RID &p_shaped) const { RID ret; - GDVIRTUAL_CALL(_shaped_text_get_parent, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_parent, p_shaped, ret); return ret; } @@ -1189,7 +1193,7 @@ double TextServerExtension::shaped_text_tab_align(const RID &p_shaped, const Pac bool TextServerExtension::shaped_text_shape(const RID &p_shaped) { bool ret = false; - GDVIRTUAL_CALL(_shaped_text_shape, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_shape, p_shaped, ret); return ret; } @@ -1207,31 +1211,31 @@ bool TextServerExtension::shaped_text_update_justification_ops(const RID &p_shap bool TextServerExtension::shaped_text_is_ready(const RID &p_shaped) const { bool ret = false; - GDVIRTUAL_CALL(_shaped_text_is_ready, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_is_ready, p_shaped, ret); return ret; } const Glyph *TextServerExtension::shaped_text_get_glyphs(const RID &p_shaped) const { GDExtensionConstPtr<const Glyph> ret; - GDVIRTUAL_CALL(_shaped_text_get_glyphs, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_glyphs, p_shaped, ret); return ret; } const Glyph *TextServerExtension::shaped_text_sort_logical(const RID &p_shaped) { GDExtensionConstPtr<const Glyph> ret; - GDVIRTUAL_CALL(_shaped_text_sort_logical, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_sort_logical, p_shaped, ret); return ret; } int64_t TextServerExtension::shaped_text_get_glyph_count(const RID &p_shaped) const { int64_t ret = 0; - GDVIRTUAL_CALL(_shaped_text_get_glyph_count, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_glyph_count, p_shaped, ret); return ret; } Vector2i TextServerExtension::shaped_text_get_range(const RID &p_shaped) const { Vector2i ret; - GDVIRTUAL_CALL(_shaped_text_get_range, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_range, p_shaped, ret); return ret; } @@ -1261,25 +1265,25 @@ PackedInt32Array TextServerExtension::shaped_text_get_word_breaks(const RID &p_s int64_t TextServerExtension::shaped_text_get_trim_pos(const RID &p_shaped) const { int64_t ret = -1; - GDVIRTUAL_CALL(_shaped_text_get_trim_pos, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_trim_pos, p_shaped, ret); return ret; } int64_t TextServerExtension::shaped_text_get_ellipsis_pos(const RID &p_shaped) const { int64_t ret = -1; - GDVIRTUAL_CALL(_shaped_text_get_ellipsis_pos, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_ellipsis_pos, p_shaped, ret); return ret; } const Glyph *TextServerExtension::shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const { GDExtensionConstPtr<const Glyph> ret; - GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyphs, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_ellipsis_glyphs, p_shaped, ret); return ret; } int64_t TextServerExtension::shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const { int64_t ret = -1; - GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyph_count, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_ellipsis_glyph_count, p_shaped, ret); return ret; } @@ -1289,61 +1293,61 @@ void TextServerExtension::shaped_text_overrun_trim_to_width(const RID &p_shaped_ Array TextServerExtension::shaped_text_get_objects(const RID &p_shaped) const { Array ret; - GDVIRTUAL_CALL(_shaped_text_get_objects, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_objects, p_shaped, ret); return ret; } Rect2 TextServerExtension::shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const { Rect2 ret; - GDVIRTUAL_CALL(_shaped_text_get_object_rect, p_shaped, p_key, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_object_rect, p_shaped, p_key, ret); return ret; } Vector2i TextServerExtension::shaped_text_get_object_range(const RID &p_shaped, const Variant &p_key) const { Vector2i ret; - GDVIRTUAL_CALL(_shaped_text_get_object_range, p_shaped, p_key, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_object_range, p_shaped, p_key, ret); return ret; } int64_t TextServerExtension::shaped_text_get_object_glyph(const RID &p_shaped, const Variant &p_key) const { int64_t ret = -1; - GDVIRTUAL_CALL(_shaped_text_get_object_glyph, p_shaped, p_key, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_object_glyph, p_shaped, p_key, ret); return ret; } Size2 TextServerExtension::shaped_text_get_size(const RID &p_shaped) const { Size2 ret; - GDVIRTUAL_CALL(_shaped_text_get_size, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_size, p_shaped, ret); return ret; } double TextServerExtension::shaped_text_get_ascent(const RID &p_shaped) const { double ret = 0; - GDVIRTUAL_CALL(_shaped_text_get_ascent, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_ascent, p_shaped, ret); return ret; } double TextServerExtension::shaped_text_get_descent(const RID &p_shaped) const { double ret = 0; - GDVIRTUAL_CALL(_shaped_text_get_descent, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_descent, p_shaped, ret); return ret; } double TextServerExtension::shaped_text_get_width(const RID &p_shaped) const { double ret = 0; - GDVIRTUAL_CALL(_shaped_text_get_width, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_width, p_shaped, ret); return ret; } double TextServerExtension::shaped_text_get_underline_position(const RID &p_shaped) const { double ret = 0; - GDVIRTUAL_CALL(_shaped_text_get_underline_position, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_underline_position, p_shaped, ret); return ret; } double TextServerExtension::shaped_text_get_underline_thickness(const RID &p_shaped) const { double ret = 0; - GDVIRTUAL_CALL(_shaped_text_get_underline_thickness, p_shaped, ret); + GDVIRTUAL_REQUIRED_CALL(_shaped_text_get_underline_thickness, p_shaped, ret); return ret; } @@ -1513,8 +1517,10 @@ String TextServerExtension::string_to_lower(const String &p_string, const String TypedArray<Vector3i> TextServerExtension::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const { TypedArray<Vector3i> ret; - GDVIRTUAL_CALL(_parse_structured_text, p_parser_type, p_args, p_text, ret); - return ret; + if (GDVIRTUAL_CALL(_parse_structured_text, p_parser_type, p_args, p_text, ret)) { + return ret; + } + return TextServer::parse_structured_text(p_parser_type, p_args, p_text); } PackedInt32Array TextServerExtension::string_get_word_breaks(const String &p_string, const String &p_language, int64_t p_chars_per_line) const { |