You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-20 14:45:44 +00:00
Use String::resize() and CharString in text_server_adv again
This commit is contained in:
@@ -2113,12 +2113,10 @@ Dictionary TextServerAdvanced::_font_get_ot_name_strings(const RID &p_font_rid)
|
||||
name = vformat("unknown_%d", names[i].name_id);
|
||||
} break;
|
||||
}
|
||||
String text;
|
||||
unsigned int text_size = hb_ot_name_get_utf32(hb_face, names[i].name_id, names[i].language, nullptr, nullptr) + 1;
|
||||
// @todo After godot-cpp#1141 is fixed, use text.resize() and write directly to text.wptr() instead of using a temporary buffer.
|
||||
char32_t *buffer = memnew_arr(char32_t, text_size);
|
||||
hb_ot_name_get_utf32(hb_face, names[i].name_id, names[i].language, &text_size, (uint32_t *)buffer);
|
||||
String text(buffer);
|
||||
memdelete_arr(buffer);
|
||||
text.resize(text_size);
|
||||
hb_ot_name_get_utf32(hb_face, names[i].name_id, names[i].language, &text_size, (uint32_t *)text.ptrw());
|
||||
if (!text.is_empty()) {
|
||||
Dictionary &id_string = names_for_lang[String(hb_language_to_string(names[i].language))];
|
||||
id_string[name] = text;
|
||||
|
||||
Reference in New Issue
Block a user