From 93ad247eff328238152b3f7d4bb1568e0f4fc61a Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Fri, 24 Feb 2023 14:49:47 +0800 Subject: [PATCH] FIX: text spaces is not work the mesh of space is null, so the width of space is 0. we use 'i' instead of space to calculate width. Change-Id: I95d92d96e19416406d644ca35f0f14ade870f315 --- src/slic3r/GUI/Gizmos/GLGizmoText.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp index aa63f4776..0120a8a04 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp @@ -931,8 +931,14 @@ bool GLGizmoText::update_text_positions(const std::vector& texts) { std::vector text_lengths; for (int i = 0; i < texts.size(); ++i) { + std::string alpha; + if (texts[i] == " ") { + alpha = "i"; + } else { + alpha = texts[i]; + } TriangleMesh mesh; - load_text_shape(texts[i].c_str(), m_font_name.c_str(), m_font_size, m_thickness + m_embeded_depth, m_bold, m_italic, mesh); + load_text_shape(alpha.c_str(), m_font_name.c_str(), m_font_size, m_thickness + m_embeded_depth, m_bold, m_italic, mesh); auto center = mesh.bounding_box().center(); double half_x_length = center.x(); text_lengths.emplace_back(half_x_length);