Fix of divided UTF8 symbol

Issue 67
This commit is contained in:
Filip Sykala - NTB T15p 2022-08-16 09:16:17 +02:00
parent 3f350b628c
commit ab807c4992

View file

@ -2587,9 +2587,11 @@ bool GLGizmoEmboss::choose_svg_file()
EmbossDataBase GLGizmoEmboss::create_emboss_data_base() {
auto create_volume_name = [&]() {
const size_t &max_len = m_gui_cfg->max_count_char_in_volume_name;
// m_text is UTF8 and can't be cutted in the middle of letter
std::wstring w_text = boost::nowide::widen(m_text);
return _u8L("Text") + " - " +
((m_text.size() > max_len) ?
(m_text.substr(0, max_len - 3) + " ..") :
((w_text.size() > max_len) ?
(boost::nowide::narrow(w_text.substr(0, max_len - 3)) + " ..") :
m_text);
};