From de43802ca884f79a88bda3fb67c8c496baef67ac Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Wed, 14 Aug 2024 12:57:22 +0200 Subject: [PATCH] Fix human readable name of font for non UTF8 fonts --- src/slic3r/Utils/WxFontUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/slic3r/Utils/WxFontUtils.cpp b/src/slic3r/Utils/WxFontUtils.cpp index 0547ce3e8c..76a04a314c 100644 --- a/src/slic3r/Utils/WxFontUtils.cpp +++ b/src/slic3r/Utils/WxFontUtils.cpp @@ -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;