summaryrefslogtreecommitdiff
path: root/scene/resources/font.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-18 14:29:58 +0100
committerGitHub <noreply@github.com>2022-03-18 14:29:58 +0100
commit5c8bd6fd71ac289415f0ff670442cd52bdc0d52b (patch)
treef2b2b3c3e1f1d67b1df414d08f054c2f1f8c8331 /scene/resources/font.cpp
parentda26fcc91a5643d592067d44d6cace34295fadda (diff)
parentf19cd44346a68a649cabfe85cc3ba7a44ceb0ca4 (diff)
Merge pull request #58233 from bruvzg/gde_ts
Diffstat (limited to 'scene/resources/font.cpp')
-rw-r--r--scene/resources/font.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index ce2a675854..15594109e9 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -40,7 +40,7 @@
_FORCE_INLINE_ void FontData::_clear_cache() {
for (int i = 0; i < cache.size(); i++) {
if (cache[i].is_valid()) {
- TS->free(cache[i]);
+ TS->free_rid(cache[i]);
cache.write[i] = RID();
}
}
@@ -1499,7 +1499,7 @@ void FontData::clear_cache() {
void FontData::remove_cache(int p_cache_index) {
ERR_FAIL_INDEX(p_cache_index, cache.size());
if (cache[p_cache_index].is_valid()) {
- TS->free(cache.write[p_cache_index]);
+ TS->free_rid(cache.write[p_cache_index]);
}
cache.remove_at(p_cache_index);
emit_changed();
@@ -1924,6 +1924,8 @@ void Font::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_supported_chars"), &Font::get_supported_chars);
ClassDB::bind_method(D_METHOD("update_changes"), &Font::update_changes);
+
+ ClassDB::bind_method(D_METHOD("get_rids"), &Font::get_rids);
}
bool Font::_set(const StringName &p_name, const Variant &p_value) {
@@ -2427,11 +2429,15 @@ String Font::get_supported_chars() const {
return chars;
}
-Vector<RID> Font::get_rids() const {
+Array Font::get_rids() const {
+ Array _rids;
for (int i = 0; i < data.size(); i++) {
_ensure_rid(i);
+ if (rids[i].is_valid()) {
+ _rids.push_back(rids[i]);
+ }
}
- return rids;
+ return _rids;
}
void Font::update_changes() {