summaryrefslogtreecommitdiff
path: root/servers/text
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-19 13:27:18 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-22 12:08:46 +0300
commitbe611c1c0592d4aaa9c58f227a9c33301acd544b (patch)
treec304cf5c4fe0ebd33a4f361f3c1b10c5b74f1da1 /servers/text
parentf4b0c7a1ea8d86c1dfd96478ca12ad1360903d9d (diff)
Implement Label3D node.
Add "generate_mipmap" font import option. Add some missing features to the Sprite3D. Move BiDi override code from Control to TextServer. Add functions to access TextServer font cache textures. Add MSDF related flags and shader to the standard material. Change standard material cache to use HashMap instead of Vector.
Diffstat (limited to 'servers/text')
-rw-r--r--servers/text/text_server_extension.cpp44
-rw-r--r--servers/text/text_server_extension.h14
2 files changed, 58 insertions, 0 deletions
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp
index c8efacc9c5..001706bb6f 100644
--- a/servers/text/text_server_extension.cpp
+++ b/servers/text/text_server_extension.cpp
@@ -67,6 +67,9 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(font_set_antialiased, "font_rid", "antialiased");
GDVIRTUAL_BIND(font_is_antialiased, "font_rid");
+ GDVIRTUAL_BIND(font_set_generate_mipmaps, "font_rid", "generate_mipmaps");
+ GDVIRTUAL_BIND(font_get_generate_mipmaps, "font_rid");
+
GDVIRTUAL_BIND(font_set_multichannel_signed_distance_field, "font_rid", "msdf");
GDVIRTUAL_BIND(font_is_multichannel_signed_distance_field, "font_rid");
@@ -151,6 +154,9 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(font_get_glyph_texture_idx, "font_rid", "size", "glyph");
GDVIRTUAL_BIND(font_set_glyph_texture_idx, "font_rid", "size", "glyph", "texture_idx");
+ GDVIRTUAL_BIND(font_get_glyph_texture_rid, "font_rid", "size", "glyph");
+ GDVIRTUAL_BIND(font_get_glyph_texture_size, "font_rid", "size", "glyph");
+
GDVIRTUAL_BIND(font_get_glyph_contours, "font_rid", "size", "index");
GDVIRTUAL_BIND(font_get_kerning_list, "font_rid", "size");
@@ -289,6 +295,8 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(string_to_upper, "string", "language");
GDVIRTUAL_BIND(string_to_lower, "string", "language");
+
+ GDVIRTUAL_BIND(parse_structured_text, "parser_type", "args", "text");
}
bool TextServerExtension::has_feature(Feature p_feature) const {
@@ -451,6 +459,18 @@ bool TextServerExtension::font_is_antialiased(const RID &p_font_rid) const {
return false;
}
+void TextServerExtension::font_set_generate_mipmaps(const RID &p_font_rid, bool p_generate_mipmaps) {
+ GDVIRTUAL_CALL(font_set_generate_mipmaps, p_font_rid, p_generate_mipmaps);
+}
+
+bool TextServerExtension::font_get_generate_mipmaps(const RID &p_font_rid) const {
+ bool ret;
+ if (GDVIRTUAL_CALL(font_get_generate_mipmaps, p_font_rid, ret)) {
+ return ret;
+ }
+ return false;
+}
+
void TextServerExtension::font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) {
GDVIRTUAL_CALL(font_set_multichannel_signed_distance_field, p_font_rid, p_msdf);
}
@@ -787,6 +807,22 @@ void TextServerExtension::font_set_glyph_texture_idx(const RID &p_font_rid, cons
GDVIRTUAL_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;
+ if (GDVIRTUAL_CALL(font_get_glyph_texture_rid, p_font_rid, p_size, p_glyph, ret)) {
+ return ret;
+ }
+ return RID();
+}
+
+Size2 TextServerExtension::font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {
+ Size2 ret;
+ if (GDVIRTUAL_CALL(font_get_glyph_texture_size, p_font_rid, p_size, p_glyph, ret)) {
+ return ret;
+ }
+ return Size2();
+}
+
Dictionary TextServerExtension::font_get_glyph_contours(const RID &p_font_rid, int64_t p_size, int64_t p_index) const {
Dictionary ret;
if (GDVIRTUAL_CALL(font_get_glyph_contours, p_font_rid, p_size, p_index, ret)) {
@@ -1459,6 +1495,14 @@ String TextServerExtension::string_to_lower(const String &p_string, const String
return p_string;
}
+Array TextServerExtension::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
+ Array ret;
+ if (GDVIRTUAL_CALL(parse_structured_text, p_parser_type, p_args, p_text, ret)) {
+ return ret;
+ }
+ return Array();
+}
+
TextServerExtension::TextServerExtension() {
//NOP
}
diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h
index c6e7bef4e8..ce781097f3 100644
--- a/servers/text/text_server_extension.h
+++ b/servers/text/text_server_extension.h
@@ -104,6 +104,11 @@ public:
GDVIRTUAL2(font_set_antialiased, RID, bool);
GDVIRTUAL1RC(bool, font_is_antialiased, RID);
+ virtual void font_set_generate_mipmaps(const RID &p_font_rid, bool p_generate_mipmaps) override;
+ virtual bool font_get_generate_mipmaps(const RID &p_font_rid) const override;
+ GDVIRTUAL2(font_set_generate_mipmaps, RID, bool);
+ GDVIRTUAL1RC(bool, font_get_generate_mipmaps, RID);
+
virtual void font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) override;
virtual bool font_is_multichannel_signed_distance_field(const RID &p_font_rid) const override;
GDVIRTUAL2(font_set_multichannel_signed_distance_field, RID, bool);
@@ -245,6 +250,12 @@ public:
GDVIRTUAL3RC(int64_t, font_get_glyph_texture_idx, RID, const Vector2i &, int64_t);
GDVIRTUAL4(font_set_glyph_texture_idx, RID, const Vector2i &, int64_t, int64_t);
+ virtual RID font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override;
+ GDVIRTUAL3RC(RID, font_get_glyph_texture_rid, RID, const Vector2i &, int64_t);
+
+ virtual Size2 font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const override;
+ GDVIRTUAL3RC(Size2, font_get_glyph_texture_size, RID, const Vector2i &, int64_t);
+
virtual Dictionary font_get_glyph_contours(const RID &p_font, int64_t p_size, int64_t p_index) const override;
GDVIRTUAL3RC(Dictionary, font_get_glyph_contours, RID, int64_t, int64_t);
@@ -479,6 +490,9 @@ public:
GDVIRTUAL2RC(String, string_to_upper, const String &, const String &);
GDVIRTUAL2RC(String, string_to_lower, const String &, const String &);
+ Array parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const;
+ GDVIRTUAL3RC(Array, parse_structured_text, StructuredTextParser, const Array &, const String &);
+
TextServerExtension();
~TextServerExtension();
};