From 6783d55ce4f0854ba36b329d5a00b2f5dd4d0088 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Sun, 8 May 2022 21:03:20 +0300 Subject: Use new HashMap implementation in the TextServer, and Font. --- modules/text_server_fb/text_server_fb.cpp | 6 +++--- modules/text_server_fb/text_server_fb.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'modules/text_server_fb') diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 96ebe025f5..4a4b51e5d3 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -1917,7 +1917,7 @@ Vector2 TextServerFallback::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 &kern = fd->cache[size]->kerning_map; + const HashMap &kern = fd->cache[size]->kerning_map; if (kern.has(p_glyph_pair)) { if (fd->msdf) { @@ -1957,7 +1957,7 @@ bool TextServerFallback::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); } - FontDataForSizeFallback *at_size = fd->cache.front()->get(); + FontDataForSizeFallback *at_size = fd->cache.begin()->value; #ifdef MODULE_FREETYPE_ENABLED if (at_size && at_size->face) { @@ -1975,7 +1975,7 @@ String TextServerFallback::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()); } - FontDataForSizeFallback *at_size = fd->cache.front()->get(); + FontDataForSizeFallback *at_size = fd->cache.begin()->value; String chars; #ifdef MODULE_FREETYPE_ENABLED diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h index c837029623..0d2fc2628d 100644 --- a/modules/text_server_fb/text_server_fb.h +++ b/modules/text_server_fb/text_server_fb.h @@ -67,7 +67,6 @@ #include #include -#include #include #include #include @@ -80,6 +79,7 @@ using namespace godot; #include "servers/text/text_server_extension.h" +#include "core/templates/hash_map.h" #include "core/templates/rid_owner.h" #include "core/templates/thread_work_pool.h" #include "scene/resources/texture.h" @@ -106,8 +106,8 @@ class TextServerFallback : public TextServerExtension { GDCLASS(TextServerFallback, TextServerExtension); _THREAD_SAFE_CLASS_ - Map feature_sets; - Map feature_sets_inv; + HashMap feature_sets; + HashMap feature_sets_inv; void _insert_feature_sets(); _FORCE_INLINE_ void _insert_feature(const StringName &p_name, int32_t p_tag); @@ -159,7 +159,7 @@ class TextServerFallback : public TextServerExtension { Vector textures; HashMap glyph_map; - Map kerning_map; + HashMap kerning_map; #ifdef MODULE_FREETYPE_ENABLED FT_Face face = nullptr; @@ -196,15 +196,15 @@ class TextServerFallback : public TextServerExtension { String font_name; String style_name; - Map cache; + HashMap cache; bool face_init = false; Dictionary supported_varaitions; Dictionary feature_overrides; // Language/script support override. - Map language_support_overrides; - Map script_support_overrides; + HashMap language_support_overrides; + HashMap script_support_overrides; PackedByteArray data; const uint8_t *data_ptr; @@ -294,7 +294,7 @@ class TextServerFallback : public TextServerExtension { InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER; Rect2 rect; }; - Map objects; + HashMap objects; /* Shaped data */ TextServer::Direction para_direction = DIRECTION_LTR; // Detected text direction. -- cgit v1.2.3