Merge branch 'fs_SPE-2442'

This commit is contained in:
Lukas Matena 2024-08-27 12:57:27 +02:00
commit 3910ee77fa
2 changed files with 11 additions and 10 deletions

View File

@ -1595,20 +1595,21 @@ void GLGizmoSVG::draw_filename(){
if (dlg.ShowModal() == wxID_OK ){
last_used_directory = dlg.GetDirectory();
wxString out_path = dlg.GetPath();
std::string path{out_path.c_str()};
//Slic3r::save(*m_volume_shape.svg_file.image, path);
//Slic3r::save(*m_volume_shape.svg_file.image, out_path.ToUTF8().data());
std::ofstream stream(path);
// Be carefull out_path_str is not UTF8 on purpose - storing into not ut6 filepath
std::string out_path_str(out_path.c_str());
std::ofstream stream(out_path_str);
if (stream.is_open()){
stream << *svg.file_data;
// change source file
m_filename_preview.clear();
m_volume_shape.svg_file->path = path;
m_volume_shape.svg_file->path = out_path.ToUTF8().data();
m_volume_shape.svg_file->path_in_3mf.clear(); // possible change name
m_volume->emboss_shape->svg_file = m_volume_shape.svg_file; // copy - write changes into volume
} else {
BOOST_LOG_TRIVIAL(error) << "Opening file: \"" << path << "\" Failed";
BOOST_LOG_TRIVIAL(error) << "Opening file: \"" << out_path_str << "\" Failed";
}
}

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());
}
}
@ -186,14 +186,14 @@ std::string WxFontUtils::store_wxFont(const wxFont &font)
"IsFixedWidth(" << font.IsFixedWidth() << "), " <<
"IsUsingSizeInPixels(" << font.IsUsingSizeInPixels() << "), " <<
"Encoding(" << (int)font.GetEncoding() << "), " ;
return std::string(font_descriptor.c_str());
return std::string(font_descriptor.ToUTF8().data());
}
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;