From cbe3a2dcb775966662fa3213625adcfa0bbdf80c Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 11 Jul 2022 12:40:31 +0300 Subject: Use BitField hint for the TextServer enums. Add missing parts for BitField support to the GDextension API. --- servers/text/text_server_extension.cpp | 16 ++++++++-------- servers/text/text_server_extension.h | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'servers/text') diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index 68959819c9..47598abce7 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -438,12 +438,12 @@ int64_t TextServerExtension::font_get_face_count(const RID &p_font_rid) const { return 0; } -void TextServerExtension::font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) { +void TextServerExtension::font_set_style(const RID &p_font_rid, BitField p_style) { GDVIRTUAL_CALL(font_set_style, p_font_rid, p_style); } -int64_t /*FontStyle*/ TextServerExtension::font_get_style(const RID &p_font_rid) const { - int64_t ret; +BitField TextServerExtension::font_get_style(const RID &p_font_rid) const { + BitField ret = 0; if (GDVIRTUAL_CALL(font_get_style, p_font_rid, ret)) { return ret; } @@ -1192,7 +1192,7 @@ RID TextServerExtension::shaped_text_get_parent(const RID &p_shaped) const { return RID(); } -double TextServerExtension::shaped_text_fit_to_width(const RID &p_shaped, double p_width, int64_t p_jst_flags) { +double TextServerExtension::shaped_text_fit_to_width(const RID &p_shaped, double p_width, BitField p_jst_flags) { double ret; if (GDVIRTUAL_CALL(shaped_text_fit_to_width, p_shaped, p_width, p_jst_flags, ret)) { return ret; @@ -1272,7 +1272,7 @@ Vector2i TextServerExtension::shaped_text_get_range(const RID &p_shaped) const { return Vector2i(); } -PackedInt32Array TextServerExtension::shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start, bool p_once, int64_t p_break_flags) const { +PackedInt32Array TextServerExtension::shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start, bool p_once, BitField p_break_flags) const { PackedInt32Array ret; if (GDVIRTUAL_CALL(shaped_text_get_line_breaks_adv, p_shaped, p_width, p_start, p_once, p_break_flags, ret)) { return ret; @@ -1280,7 +1280,7 @@ PackedInt32Array TextServerExtension::shaped_text_get_line_breaks_adv(const RID return TextServer::shaped_text_get_line_breaks_adv(p_shaped, p_width, p_start, p_once, p_break_flags); } -PackedInt32Array TextServerExtension::shaped_text_get_line_breaks(const RID &p_shaped, double p_width, int64_t p_start, int64_t p_break_flags) const { +PackedInt32Array TextServerExtension::shaped_text_get_line_breaks(const RID &p_shaped, double p_width, int64_t p_start, BitField p_break_flags) const { PackedInt32Array ret; if (GDVIRTUAL_CALL(shaped_text_get_line_breaks, p_shaped, p_width, p_start, p_break_flags, ret)) { return ret; @@ -1288,7 +1288,7 @@ PackedInt32Array TextServerExtension::shaped_text_get_line_breaks(const RID &p_s return TextServer::shaped_text_get_line_breaks(p_shaped, p_width, p_start, p_break_flags); } -PackedInt32Array TextServerExtension::shaped_text_get_word_breaks(const RID &p_shaped, int64_t p_grapheme_flags) const { +PackedInt32Array TextServerExtension::shaped_text_get_word_breaks(const RID &p_shaped, BitField p_grapheme_flags) const { PackedInt32Array ret; if (GDVIRTUAL_CALL(shaped_text_get_word_breaks, p_shaped, p_grapheme_flags, ret)) { return ret; @@ -1328,7 +1328,7 @@ int64_t TextServerExtension::shaped_text_get_ellipsis_glyph_count(const RID &p_s return -1; } -void TextServerExtension::shaped_text_overrun_trim_to_width(const RID &p_shaped_line, double p_width, int64_t p_trim_flags) { +void TextServerExtension::shaped_text_overrun_trim_to_width(const RID &p_shaped_line, double p_width, BitField p_trim_flags) { GDVIRTUAL_CALL(shaped_text_overrun_trim_to_width, p_shaped_line, p_width, p_trim_flags); } diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h index d948a97c66..571753ea67 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -92,10 +92,10 @@ public: virtual int64_t font_get_face_count(const RID &p_font_rid) const override; GDVIRTUAL1RC(int64_t, font_get_face_count, RID); - virtual void font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) override; - virtual int64_t /*FontStyle*/ font_get_style(const RID &p_font_rid) const override; - GDVIRTUAL2(font_set_style, RID, int64_t); - GDVIRTUAL1RC(int64_t, font_get_style, RID); + virtual void font_set_style(const RID &p_font_rid, BitField p_style) override; + virtual BitField font_get_style(const RID &p_font_rid) const override; + GDVIRTUAL2(font_set_style, RID, BitField); + GDVIRTUAL1RC(BitField, font_get_style, RID); virtual void font_set_name(const RID &p_font_rid, const String &p_name) override; virtual String font_get_name(const RID &p_font_rid) const override; @@ -396,9 +396,9 @@ public: GDVIRTUAL3RC(RID, shaped_text_substr, RID, int64_t, int64_t); GDVIRTUAL1RC(RID, shaped_text_get_parent, RID); - virtual double shaped_text_fit_to_width(const RID &p_shaped, double p_width, int64_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) override; + virtual double shaped_text_fit_to_width(const RID &p_shaped, double p_width, BitField p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) override; virtual double shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) override; - GDVIRTUAL3R(double, shaped_text_fit_to_width, RID, double, int64_t); + GDVIRTUAL3R(double, shaped_text_fit_to_width, RID, double, BitField); GDVIRTUAL2R(double, shaped_text_tab_align, RID, const PackedFloat32Array &); virtual bool shaped_text_shape(const RID &p_shaped) override; @@ -421,12 +421,12 @@ public: virtual Vector2i shaped_text_get_range(const RID &p_shaped) const override; GDVIRTUAL1RC(Vector2i, shaped_text_get_range, RID); - virtual PackedInt32Array shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start = 0, bool p_once = true, int64_t /*TextBreakFlag*/ p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; - virtual PackedInt32Array shaped_text_get_line_breaks(const RID &p_shaped, double p_width, int64_t p_start = 0, int64_t p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; - virtual PackedInt32Array shaped_text_get_word_breaks(const RID &p_shaped, int64_t p_grapheme_flags = GRAPHEME_IS_SPACE | GRAPHEME_IS_PUNCTUATION) const override; - GDVIRTUAL5RC(PackedInt32Array, shaped_text_get_line_breaks_adv, RID, const PackedFloat32Array &, int64_t, bool, int64_t); - GDVIRTUAL4RC(PackedInt32Array, shaped_text_get_line_breaks, RID, double, int64_t, int64_t); - GDVIRTUAL2RC(PackedInt32Array, shaped_text_get_word_breaks, RID, int64_t); + virtual PackedInt32Array shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start = 0, bool p_once = true, BitField p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; + virtual PackedInt32Array shaped_text_get_line_breaks(const RID &p_shaped, double p_width, int64_t p_start = 0, BitField p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; + virtual PackedInt32Array shaped_text_get_word_breaks(const RID &p_shaped, BitField p_grapheme_flags = GRAPHEME_IS_SPACE | GRAPHEME_IS_PUNCTUATION) const override; + GDVIRTUAL5RC(PackedInt32Array, shaped_text_get_line_breaks_adv, RID, const PackedFloat32Array &, int64_t, bool, BitField); + GDVIRTUAL4RC(PackedInt32Array, shaped_text_get_line_breaks, RID, double, int64_t, BitField); + GDVIRTUAL2RC(PackedInt32Array, shaped_text_get_word_breaks, RID, BitField); virtual int64_t shaped_text_get_trim_pos(const RID &p_shaped) const override; virtual int64_t shaped_text_get_ellipsis_pos(const RID &p_shaped) const override; @@ -437,8 +437,8 @@ public: GDVIRTUAL1RC(GDNativeConstPtr, shaped_text_get_ellipsis_glyphs, RID); GDVIRTUAL1RC(int64_t, shaped_text_get_ellipsis_glyph_count, RID); - virtual void shaped_text_overrun_trim_to_width(const RID &p_shaped, double p_width, int64_t p_trim_flags) override; - GDVIRTUAL3(shaped_text_overrun_trim_to_width, RID, double, int64_t); + virtual void shaped_text_overrun_trim_to_width(const RID &p_shaped, double p_width, BitField p_trim_flags) override; + GDVIRTUAL3(shaped_text_overrun_trim_to_width, RID, double, BitField); virtual Array shaped_text_get_objects(const RID &p_shaped) const override; virtual Rect2 shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const override; -- cgit v1.2.3