diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2021-10-01 09:19:46 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2021-10-01 09:25:26 +0300 |
commit | 2e035272a8e9abdb5c2265877b24e51a0b0e834a (patch) | |
tree | 0416008c7bd739545e4eaa7aab32a76261c64aec /scene | |
parent | df57aa670af563afafd7e38505bb0a939b2042af (diff) |
[FontData] Fixes saving copy of the font source data, if it was created from built-in font.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/font.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 9b403a18f0..de561bb852 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -502,6 +502,11 @@ void FontData::set_data(const PackedByteArray &p_data) { } PackedByteArray FontData::get_data() const { + if (unlikely((size_t)data.size() != data_size)) { + PackedByteArray *data_w = const_cast<PackedByteArray *>(&data); + data_w->resize(data_size); + memcpy(data_w->ptrw(), data_ptr, data_size); + } return data; } |