diff --git a/src/libslic3r/Emboss.cpp b/src/libslic3r/Emboss.cpp index 556d11d8a3..7c4d93661c 100644 --- a/src/libslic3r/Emboss.cpp +++ b/src/libslic3r/Emboss.cpp @@ -188,9 +188,9 @@ std::optional Private::get_glyph( } FontItem Private::create_font_item(std::wstring name, std::wstring path) { - return FontItem(boost::nowide::narrow(name.c_str()), - boost::nowide::narrow(path.c_str()), - FontItem::Type::file_path, FontProp()); + return { boost::nowide::narrow(name.c_str()), + boost::nowide::narrow(path.c_str()), + FontItem::Type::file_path, FontProp() }; } ExPolygons Private::dilate_to_unique_points(ExPolygons &expolygons) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index 8e7b402cd5..da9d3a68d2 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -3374,14 +3374,14 @@ std::optional TextConfigurationSerialization::read(const char std::string weight = get_attribute_value_string(attributes, num_attributes, FONT_WEIGHT_ATTR); if (!weight.empty()) fp.weight = weight; - std::string font_name = ""; + std::string font_name {}; std::string font_descriptor = get_attribute_value_string(attributes, num_attributes, FONT_DESCRIPTOR_ATTR); std::string type_str = get_attribute_value_string(attributes, num_attributes, FONT_DESCRIPTOR_TYPE_ATTR); FontItem::Type type = TextConfigurationSerialization::get_type(type_str); - FontItem fi(font_name, font_descriptor, type, fp); + FontItem fi{ font_name, std::move(font_descriptor), type, std::move(fp) }; std::string text = get_attribute_value_string(attributes, num_attributes, TEXT_DATA_ATTR); - return TextConfiguration(fi, text); + return TextConfiguration(std::move(fi), std::move(text)); } diff --git a/src/libslic3r/TextConfiguration.hpp b/src/libslic3r/TextConfiguration.hpp index b0549c860f..7cfa532a0b 100644 --- a/src/libslic3r/TextConfiguration.hpp +++ b/src/libslic3r/TextConfiguration.hpp @@ -118,22 +118,11 @@ struct FontItem enum class Type; // Define what is stored in path - Type type; + Type type { Type::undefined }; // User modification of font style FontProp prop; - FontItem() : type(Type::undefined){} // set undefined type - - // when name is empty than Font item was loaded from .3mf file - // and potentionaly it is not reproducable - FontItem(const std::string &name, - const std::string &path, - Type type, - const FontProp & prop) - : name(name), path(path), type(type), prop(prop) // copy values - {} - // define data stored in path // when wx change way of storing add new descriptor Type enum class Type { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index d543825c27..c6b8157071 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -1824,7 +1824,7 @@ bool GLGizmoEmboss::choose_true_type_file() std::string name = get_file_name(path); //make_unique_name(name, m_font_list); const FontProp& prop = m_font_manager.get_font_prop(); - FontItem fi(name, path, FontItem::Type::file_path, prop); + FontItem fi{ name, path, FontItem::Type::file_path, prop }; m_font_manager.add_font(fi); // set first valid added font as active if (m_font_manager.load_font(index)) return true; diff --git a/src/slic3r/Utils/FontListSerializable.cpp b/src/slic3r/Utils/FontListSerializable.cpp index 0ccbae3441..8f83f93e1c 100644 --- a/src/slic3r/Utils/FontListSerializable.cpp +++ b/src/slic3r/Utils/FontListSerializable.cpp @@ -87,7 +87,7 @@ std::optional FontListSerializable::load_font_item( read(app_cfg_section, APP_CONFIG_FONT_LINE_GAP, fp.line_gap); FontItem::Type type = WxFontUtils::get_actual_type(); - return FontItem(name, path, type, fp); + return FontItem{ name, path, type, fp }; } void FontListSerializable::store_font_item(AppConfig & cfg, diff --git a/src/slic3r/Utils/WxFontUtils.cpp b/src/slic3r/Utils/WxFontUtils.cpp index d9e42742f3..4efdf2c38f 100644 --- a/src/slic3r/Utils/WxFontUtils.cpp +++ b/src/slic3r/Utils/WxFontUtils.cpp @@ -96,7 +96,7 @@ FontItem WxFontUtils::get_font_item(const wxFont &font, const std::string& name) // synchronize font property with actual font FontProp font_prop; WxFontUtils::update_property(font_prop, font); - return FontItem(name_item, fontDesc, type, font_prop); + return { name_item, fontDesc, type, font_prop }; } FontItem WxFontUtils::get_os_font()