Fix human readable name of font for non UTF8 fonts

This commit is contained in:
Filip Sykala - NTB T15p 2024-08-14 12:57:22 +02:00 committed by Lukas Matena
parent 79dc95d3e8
commit de43802ca8

View File

@ -166,12 +166,12 @@ std::string WxFontUtils::get_human_readable_name(const wxFont &font)
if (!font.IsOk()) return "Font is NOT ok.";
// Face name is optional in wxFont
if (!font.GetFaceName().empty()) {
return std::string(font.GetFaceName().c_str());
return std::string(font.GetFaceName().ToUTF8().data());
} else {
return std::string((font.GetFamilyString() + " " +
font.GetStyleString() + " " +
font.GetWeightString())
.c_str());
.ToUTF8().data());
}
}
@ -193,7 +193,7 @@ wxFont WxFontUtils::load_wxFont(const std::string &font_descriptor)
{
BOOST_LOG_TRIVIAL(trace) << "'" << font_descriptor << "'font descriptor string param of load_wxFont()";
wxString font_descriptor_wx(font_descriptor);
BOOST_LOG_TRIVIAL(trace) << "'" << font_descriptor_wx.c_str() << "' wx string descriptor";
BOOST_LOG_TRIVIAL(trace) << "'" << font_descriptor_wx.ToUTF8().data() << "' wx string descriptor";
wxFont wx_font(font_descriptor_wx);
BOOST_LOG_TRIVIAL(trace) << "loaded font is '" << get_human_readable_name(wx_font) << "'.";
return wx_font;