[TextMesh, 3.x] Fix auto-translation and ignore control chars.

This commit is contained in:
bruvzg 2022-12-04 23:03:54 +02:00
parent 6a99678bc6
commit efa6b01c97
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
2 changed files with 101 additions and 92 deletions

View file

@ -664,6 +664,12 @@ void MeshInstance::_notification(int p_what) {
_resolve_skeleton_path();
}
if (p_what == NOTIFICATION_TRANSLATION_CHANGED) {
if (mesh.is_valid()) {
mesh->notification(NOTIFICATION_TRANSLATION_CHANGED);
}
}
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
if (skin_ref.is_valid() && mesh.is_valid() && _is_software_skinning_enabled()) {
ERR_FAIL_COND(!skin_ref->get_skeleton_node());

View file

@ -1987,7 +1987,7 @@ void TextMesh::_create_mesh_array(Array &p_arr) const {
if ((c & 0xfffffc00) == 0xdc00) { // skip trail surrogate.
continue;
}
if (utf32_char >= 0x20) {
_generate_glyph_mesh_data(utf32_char, font, c, n);
GlyphMeshData &gl_data = cache[utf32_char];
@ -2005,6 +2005,7 @@ void TextMesh::_create_mesh_array(Array &p_arr) const {
min_p.y = MIN(gl_data.min_p.y + offset_pre.y, min_p.y);
max_p.x = MAX(gl_data.max_p.x + offset_pre.x, max_p.x);
max_p.y = MAX(gl_data.max_p.y + offset_pre.y, max_p.y);
}
offset_pre.x += font->get_char_size(c, n).x * pixel_size;
}
@ -2041,6 +2042,7 @@ void TextMesh::_create_mesh_array(Array &p_arr) const {
if ((c & 0xfffffc00) == 0xdc00) { // skip trail surrogate.
continue;
}
if (utf32_char >= 0x20) {
_generate_glyph_mesh_data(utf32_char, font, c, n);
GlyphMeshData &gl_data = cache[utf32_char];
@ -2135,6 +2137,7 @@ void TextMesh::_create_mesh_array(Array &p_arr) const {
}
}
}
}
offset.x += font->get_char_size(c, n).x * pixel_size;
}