diff options
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r-- | modules/text_server_adv/text_server_adv.cpp | 8 | ||||
-rw-r--r-- | modules/text_server_adv/text_server_adv.h | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index c5fa126d0f..fe3a43dc97 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -2769,7 +2769,7 @@ Vector2 TextServerAdvanced::font_get_kerning(const RID &p_font_rid, int64_t p_si ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, size), Vector2()); - const Map<Vector2i, Vector2> &kern = fd->cache[size]->kerning_map; + const HashMap<Vector2i, Vector2, VariantHasher, VariantComparator> &kern = fd->cache[size]->kerning_map; if (kern.has(p_glyph_pair)) { if (fd->msdf) { @@ -2827,7 +2827,7 @@ bool TextServerAdvanced::font_has_char(const RID &p_font_rid, int64_t p_char) co if (fd->cache.is_empty()) { ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, fd->msdf ? Vector2i(fd->msdf_source_size, 0) : Vector2i(16, 0)), false); } - FontDataForSizeAdvanced *at_size = fd->cache.front()->get(); + FontDataForSizeAdvanced *at_size = fd->cache.begin()->value; #ifdef MODULE_FREETYPE_ENABLED if (at_size && at_size->face) { @@ -2845,7 +2845,7 @@ String TextServerAdvanced::font_get_supported_chars(const RID &p_font_rid) const if (fd->cache.is_empty()) { ERR_FAIL_COND_V(!_ensure_cache_for_size(fd, fd->msdf ? Vector2i(fd->msdf_source_size, 0) : Vector2i(16, 0)), String()); } - FontDataForSizeAdvanced *at_size = fd->cache.front()->get(); + FontDataForSizeAdvanced *at_size = fd->cache.begin()->value; String chars; #ifdef MODULE_FREETYPE_ENABLED @@ -4575,7 +4575,7 @@ bool TextServerAdvanced::shaped_text_update_justification_ops(const RID &p_shape Glyph *sd_glyphs = sd->glyphs.ptrw(); int sd_size = sd->glyphs.size(); - if (sd->jstops.size() > 0) { + if (!sd->jstops.is_empty()) { for (int i = 0; i < sd_size; i++) { if (sd_glyphs[i].count > 0) { char32_t c = sd->text[sd_glyphs[i].start - sd->start]; diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h index 1b4293aa72..c292e2e707 100644 --- a/modules/text_server_adv/text_server_adv.h +++ b/modules/text_server_adv/text_server_adv.h @@ -67,7 +67,6 @@ #include <godot_cpp/classes/ref.hpp> #include <godot_cpp/templates/hash_map.hpp> -#include <godot_cpp/templates/map.hpp> #include <godot_cpp/templates/rid_owner.hpp> #include <godot_cpp/templates/set.hpp> #include <godot_cpp/templates/thread_work_pool.hpp> @@ -78,6 +77,7 @@ using namespace godot; #else // Headers for building as built-in module. +#include "core/templates/hash_map.h" #include "core/templates/rid_owner.h" #include "core/templates/thread_work_pool.h" #include "scene/resources/texture.h" @@ -133,8 +133,8 @@ class TextServerAdvanced : public TextServerExtension { }; Vector<NumSystemData> num_systems; - Map<StringName, int32_t> feature_sets; - Map<int32_t, StringName> feature_sets_inv; + HashMap<StringName, int32_t> feature_sets; + HashMap<int32_t, StringName> feature_sets_inv; void _insert_num_systems_lang(); void _insert_feature_sets(); @@ -191,7 +191,7 @@ class TextServerAdvanced : public TextServerExtension { Vector<FontTexture> textures; HashMap<int32_t, FontGlyph> glyph_map; - Map<Vector2i, Vector2> kerning_map; + HashMap<Vector2i, Vector2, VariantHasher, VariantComparator> kerning_map; hb_font_t *hb_handle = nullptr; @@ -233,7 +233,7 @@ class TextServerAdvanced : public TextServerExtension { String font_name; String style_name; - Map<Vector2i, FontDataForSizeAdvanced *> cache; + HashMap<Vector2i, FontDataForSizeAdvanced *, VariantHasher, VariantComparator> cache; bool face_init = false; Set<uint32_t> supported_scripts; @@ -242,8 +242,8 @@ class TextServerAdvanced : public TextServerExtension { Dictionary feature_overrides; // Language/script support override. - Map<String, bool> language_support_overrides; - Map<String, bool> script_support_overrides; + HashMap<String, bool> language_support_overrides; + HashMap<String, bool> script_support_overrides; PackedByteArray data; const uint8_t *data_ptr; @@ -334,7 +334,7 @@ class TextServerAdvanced : public TextServerExtension { InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER; Rect2 rect; }; - Map<Variant, EmbeddedObject> objects; + HashMap<Variant, EmbeddedObject, VariantHasher, VariantComparator> objects; /* Shaped data */ TextServer::Direction para_direction = DIRECTION_LTR; // Detected text direction. |