mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 05:26:02 +08:00
store to .3mf
This commit is contained in:
parent
b359c0797c
commit
bbeff0f2e6
@ -157,6 +157,10 @@ static constexpr const char *LINE_GAP_ATTR = "line_gap";
|
|||||||
static constexpr const char *LINE_HEIGHT_ATTR = "line_height";
|
static constexpr const char *LINE_HEIGHT_ATTR = "line_height";
|
||||||
static constexpr const char *DEPTH_ATTR = "depth";
|
static constexpr const char *DEPTH_ATTR = "depth";
|
||||||
|
|
||||||
|
static constexpr const char *FONT_FACE_NAME_ATTR = "face_name";
|
||||||
|
static constexpr const char *FONT_STYLE_ATTR = "style";
|
||||||
|
static constexpr const char *FONT_WEIGHT_ATTR = "weight";
|
||||||
|
|
||||||
const unsigned int VALID_OBJECT_TYPES_COUNT = 1;
|
const unsigned int VALID_OBJECT_TYPES_COUNT = 1;
|
||||||
const char* VALID_OBJECT_TYPES[] =
|
const char* VALID_OBJECT_TYPES[] =
|
||||||
{
|
{
|
||||||
@ -3259,7 +3263,13 @@ void TextConfigurationSerialization::to_xml(std::stringstream &stream, const Tex
|
|||||||
stream << LINE_GAP_ATTR << "=\"" << fp.line_gap << "\" ";
|
stream << LINE_GAP_ATTR << "=\"" << fp.line_gap << "\" ";
|
||||||
stream << LINE_HEIGHT_ATTR << "=\"" << fp.size_in_mm << "\" ";
|
stream << LINE_HEIGHT_ATTR << "=\"" << fp.size_in_mm << "\" ";
|
||||||
stream << DEPTH_ATTR << "=\"" << fp.emboss << "\" ";
|
stream << DEPTH_ATTR << "=\"" << fp.emboss << "\" ";
|
||||||
|
// font descriptor
|
||||||
|
if (fp.face_name.has_value())
|
||||||
|
stream << FONT_FACE_NAME_ATTR << "=\"" << *fp.face_name << "\" ";
|
||||||
|
if (fp.style.has_value())
|
||||||
|
stream << FONT_STYLE_ATTR << "=\"" << *fp.style << "\" ";
|
||||||
|
if (fp.weight.has_value())
|
||||||
|
stream << FONT_WEIGHT_ATTR << "=\"" << *fp.weight << "\" ";
|
||||||
stream << "/>\n"; // end TEXT_TAG
|
stream << "/>\n"; // end TEXT_TAG
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3278,6 +3288,13 @@ std::optional<TextConfiguration> TextConfigurationSerialization::read(const char
|
|||||||
fp.size_in_mm = get_attribute_value_float(attributes, num_attributes, LINE_HEIGHT_ATTR);
|
fp.size_in_mm = get_attribute_value_float(attributes, num_attributes, LINE_HEIGHT_ATTR);
|
||||||
fp.emboss = get_attribute_value_float(attributes, num_attributes, DEPTH_ATTR);
|
fp.emboss = get_attribute_value_float(attributes, num_attributes, DEPTH_ATTR);
|
||||||
|
|
||||||
|
std::string face_name = get_attribute_value_string(attributes, num_attributes, FONT_FACE_NAME_ATTR);
|
||||||
|
if (!face_name.empty()) fp.face_name = face_name;
|
||||||
|
std::string style = get_attribute_value_string(attributes, num_attributes, FONT_STYLE_ATTR);
|
||||||
|
if (!style.empty()) fp.style = style;
|
||||||
|
std::string weight = get_attribute_value_string(attributes, num_attributes, FONT_WEIGHT_ATTR);
|
||||||
|
if (!weight.empty()) fp.weight = weight;
|
||||||
|
|
||||||
return TextConfiguration(fi, fp, text);
|
return TextConfiguration(fi, fp, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,6 +241,7 @@ void GLGizmoEmboss::on_set_state()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_volume = nullptr;
|
m_volume = nullptr;
|
||||||
|
remove_notification_not_valid_font();
|
||||||
} else if (GLGizmoBase::m_state == GLGizmoBase::On) {
|
} else if (GLGizmoBase::m_state == GLGizmoBase::On) {
|
||||||
if (!m_is_initialized) initialize();
|
if (!m_is_initialized) initialize();
|
||||||
|
|
||||||
@ -852,9 +853,10 @@ bool GLGizmoEmboss::choose_font_by_wxdialog()
|
|||||||
FontProp old_font_prop = m_font_prop; // copy
|
FontProp old_font_prop = m_font_prop; // copy
|
||||||
|
|
||||||
// Check that deserialization NOT influence font
|
// Check that deserialization NOT influence font
|
||||||
// false - use direct selected font in dialog
|
// false - use direct selected wxFont in dialog
|
||||||
// true - use font item (serialize and deserialize wxFont)
|
// true - use font item (serialize and deserialize wxFont)
|
||||||
bool use_deserialized_font = false;
|
bool use_deserialized_font = false;
|
||||||
|
if (!use_deserialized_font) m_font_selected = font_index;
|
||||||
// Try load and use new added font
|
// Try load and use new added font
|
||||||
if ((!use_deserialized_font && !load_font(font)) ||
|
if ((!use_deserialized_font && !load_font(font)) ||
|
||||||
(use_deserialized_font && !load_font(font_index)) ||
|
(use_deserialized_font && !load_font(font_index)) ||
|
||||||
@ -997,7 +999,7 @@ void GLGizmoEmboss::create_notification_not_valid_font(
|
|||||||
|
|
||||||
const auto& origin_family = tc.font_prop.face_name;
|
const auto& origin_family = tc.font_prop.face_name;
|
||||||
const auto& actual_family = m_font_prop.face_name;
|
const auto& actual_family = m_font_prop.face_name;
|
||||||
const auto &fi = m_font_list[m_font_selected];
|
const auto& fi = m_font_list[m_font_selected];
|
||||||
|
|
||||||
const std::string& origin_font_name = origin_family.has_value()? *origin_family : tc.font_item.path;
|
const std::string& origin_font_name = origin_family.has_value()? *origin_family : tc.font_item.path;
|
||||||
const std::string &actual_font_name = actual_family.has_value()? *actual_family : fi.name;
|
const std::string &actual_font_name = actual_family.has_value()? *actual_family : fi.name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user