diff options
Diffstat (limited to 'servers/text/text_server_extension.cpp')
-rw-r--r-- | servers/text/text_server_extension.cpp | 171 |
1 files changed, 139 insertions, 32 deletions
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index c8efacc9c5..c53560523d 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -55,6 +55,11 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(font_set_data, "font_rid", "data"); GDVIRTUAL_BIND(font_set_data_ptr, "font_rid", "data_ptr", "data_size"); + GDVIRTUAL_BIND(font_set_face_index, "font_rid", "face_index"); + GDVIRTUAL_BIND(font_get_face_index, "font_rid"); + + GDVIRTUAL_BIND(font_get_face_count, "font_rid"); + GDVIRTUAL_BIND(font_set_style, "font_rid", "style"); GDVIRTUAL_BIND(font_get_style, "font_rid"); @@ -67,6 +72,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"); @@ -119,9 +127,6 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(font_set_scale, "font_rid", "size", "scale"); GDVIRTUAL_BIND(font_get_scale, "font_rid", "size"); - GDVIRTUAL_BIND(font_set_spacing, "font_rid", "size", "spacing", "value"); - GDVIRTUAL_BIND(font_get_spacing, "font_rid", "size", "spacing"); - GDVIRTUAL_BIND(font_get_texture_count, "font_rid", "size"); GDVIRTUAL_BIND(font_clear_textures, "font_rid", "size"); GDVIRTUAL_BIND(font_remove_texture, "font_rid", "size", "texture_index"); @@ -151,6 +156,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"); @@ -219,6 +227,9 @@ 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_set_spacing, "shaped", "spacing", "value"); + GDVIRTUAL_BIND(shaped_text_get_spacing, "shaped", "spacing"); + 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"); @@ -286,9 +297,17 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(percent_sign, "language"); GDVIRTUAL_BIND(strip_diacritics, "string"); + GDVIRTUAL_BIND(is_valid_identifier, "string"); + + GDVIRTUAL_BIND(string_get_word_breaks, "string", "language"); + + GDVIRTUAL_BIND(is_confusable, "string", "dict"); + GDVIRTUAL_BIND(spoof_check, "string"); 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 { @@ -403,12 +422,32 @@ void TextServerExtension::font_set_data_ptr(const RID &p_font_rid, const uint8_t GDVIRTUAL_CALL(font_set_data_ptr, p_font_rid, p_data_ptr, p_data_size); } -void TextServerExtension::font_set_style(const RID &p_font_rid, int64_t /*FontStyle*/ p_style) { - GDVIRTUAL_CALL(font_set_style, p_font_rid, p_style); +void TextServerExtension::font_set_face_index(const RID &p_font_rid, int64_t p_index) { + GDVIRTUAL_CALL(font_set_face_index, p_font_rid, p_index); +} + +int64_t TextServerExtension::font_get_face_index(const RID &p_font_rid) const { + int64_t ret; + if (GDVIRTUAL_CALL(font_get_face_index, p_font_rid, ret)) { + return ret; + } + return 0; } -int64_t /*FontStyle*/ TextServerExtension::font_get_style(const RID &p_font_rid) const { +int64_t TextServerExtension::font_get_face_count(const RID &p_font_rid) const { int64_t ret; + if (GDVIRTUAL_CALL(font_get_face_count, p_font_rid, ret)) { + return ret; + } + return 0; +} + +void TextServerExtension::font_set_style(const RID &p_font_rid, BitField<TextServer::FontStyle> p_style) { + GDVIRTUAL_CALL(font_set_style, p_font_rid, p_style); +} + +BitField<TextServer::FontStyle> TextServerExtension::font_get_style(const RID &p_font_rid) const { + BitField<TextServer::FontStyle> ret = 0; if (GDVIRTUAL_CALL(font_get_style, p_font_rid, ret)) { return ret; } @@ -451,6 +490,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); } @@ -583,12 +634,12 @@ double TextServerExtension::font_get_oversampling(const RID &p_font_rid) const { return 0.0; } -Array TextServerExtension::font_get_size_cache_list(const RID &p_font_rid) const { - Array ret; +TypedArray<Vector2i> TextServerExtension::font_get_size_cache_list(const RID &p_font_rid) const { + TypedArray<Vector2i> ret; if (GDVIRTUAL_CALL(font_get_size_cache_list, p_font_rid, ret)) { return ret; } - return Array(); + return TypedArray<Vector2i>(); } void TextServerExtension::font_clear_size_cache(const RID &p_font_rid) { @@ -659,18 +710,6 @@ double TextServerExtension::font_get_scale(const RID &p_font_rid, int64_t p_size return 0.0; } -void TextServerExtension::font_set_spacing(const RID &p_font_rid, int64_t p_size, TextServer::SpacingType p_spacing, int64_t p_value) { - GDVIRTUAL_CALL(font_set_spacing, p_font_rid, p_size, p_spacing, p_value); -} - -int64_t TextServerExtension::font_get_spacing(const RID &p_font_rid, int64_t p_size, TextServer::SpacingType p_spacing) const { - int64_t ret; - if (GDVIRTUAL_CALL(font_get_spacing, p_font_rid, p_size, p_spacing, ret)) { - return ret; - } - return 0; -} - int64_t TextServerExtension::font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const { int64_t ret; if (GDVIRTUAL_CALL(font_get_texture_count, p_font_rid, p_size, ret)) { @@ -711,12 +750,12 @@ PackedInt32Array TextServerExtension::font_get_texture_offsets(const RID &p_font return PackedInt32Array(); } -Array TextServerExtension::font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const { - Array ret; +PackedInt32Array TextServerExtension::font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const { + PackedInt32Array ret; if (GDVIRTUAL_CALL(font_get_glyph_list, p_font_rid, p_size, ret)) { return ret; } - return Array(); + return PackedInt32Array(); } void TextServerExtension::font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) { @@ -787,6 +826,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)) { @@ -795,12 +850,12 @@ Dictionary TextServerExtension::font_get_glyph_contours(const RID &p_font_rid, i return Dictionary(); } -Array TextServerExtension::font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const { - Array ret; +TypedArray<Vector2i> TextServerExtension::font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const { + TypedArray<Vector2i> ret; if (GDVIRTUAL_CALL(font_get_kerning_list, p_font_rid, p_size, ret)) { return ret; } - return Array(); + return TypedArray<Vector2i>(); } void TextServerExtension::font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) { @@ -1069,6 +1124,18 @@ bool TextServerExtension::shaped_text_get_preserve_control(const RID &p_shaped) return false; } +void TextServerExtension::shaped_text_set_spacing(const RID &p_shaped, TextServer::SpacingType p_spacing, int64_t p_value) { + GDVIRTUAL_CALL(shaped_text_set_spacing, p_shaped, p_spacing, p_value); +} + +int64_t TextServerExtension::shaped_text_get_spacing(const RID &p_shaped, TextServer::SpacingType p_spacing) const { + int64_t ret; + if (GDVIRTUAL_CALL(shaped_text_get_spacing, p_shaped, p_spacing, ret)) { + return ret; + } + return 0; +} + bool TextServerExtension::shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { bool ret; if (GDVIRTUAL_CALL(shaped_text_add_string, p_shaped, p_text, p_fonts, p_size, p_opentype_features, p_language, p_meta, ret)) { @@ -1129,7 +1196,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<TextServer::JustificationFlag> p_jst_flags) { double ret; if (GDVIRTUAL_CALL(shaped_text_fit_to_width, p_shaped, p_width, p_jst_flags, ret)) { return ret; @@ -1209,7 +1276,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<TextServer::LineBreakFlag> 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; @@ -1217,7 +1284,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<TextServer::LineBreakFlag> 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; @@ -1225,7 +1292,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<TextServer::GraphemeFlag> p_grapheme_flags) const { PackedInt32Array ret; if (GDVIRTUAL_CALL(shaped_text_get_word_breaks, p_shaped, p_grapheme_flags, ret)) { return ret; @@ -1265,7 +1332,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<TextServer::TextOverrunFlag> p_trim_flags) { GDVIRTUAL_CALL(shaped_text_overrun_trim_to_width, p_shaped_line, p_width, p_trim_flags); } @@ -1435,6 +1502,14 @@ String TextServerExtension::percent_sign(const String &p_language) const { return "%"; } +bool TextServerExtension::is_valid_identifier(const String &p_string) const { + bool ret; + if (GDVIRTUAL_CALL(is_valid_identifier, p_string, ret)) { + return ret; + } + return TextServer::is_valid_identifier(p_string); +} + String TextServerExtension::strip_diacritics(const String &p_string) const { String ret; if (GDVIRTUAL_CALL(strip_diacritics, p_string, ret)) { @@ -1459,6 +1534,38 @@ 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(); +} + +PackedInt32Array TextServerExtension::string_get_word_breaks(const String &p_string, const String &p_language) const { + PackedInt32Array ret; + if (GDVIRTUAL_CALL(string_get_word_breaks, p_string, p_language, ret)) { + return ret; + } + return PackedInt32Array(); +} + +int TextServerExtension::is_confusable(const String &p_string, const PackedStringArray &p_dict) const { + int ret; + if (GDVIRTUAL_CALL(is_confusable, p_string, p_dict, ret)) { + return ret; + } + return TextServer::is_confusable(p_string, p_dict); +} + +bool TextServerExtension::spoof_check(const String &p_string) const { + bool ret; + if (GDVIRTUAL_CALL(spoof_check, p_string, ret)) { + return ret; + } + return TextServer::spoof_check(p_string); +} + TextServerExtension::TextServerExtension() { //NOP } |