From 5bb35c308687040a636dee8c20737c3991c2a452 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Tue, 21 Mar 2023 16:03:04 +0800 Subject: [PATCH] FIX: German Umlaut's not usable (3D Text Tool) STUDIO-2515 Change-Id: I193cb00f86476ed9088d69426ed17816a9df8de5 --- src/slic3r/GUI/Gizmos/GLGizmoText.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp index 058bc409a9..f62387d5ec 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp @@ -21,6 +21,7 @@ #endif #include #include "libslic3r/SVG.hpp" +#include namespace Slic3r { namespace GUI { @@ -1378,6 +1379,11 @@ TriangleMesh GLGizmoText::get_text_mesh(const char* text_str, const Vec3d &posit Vec3d new_text_dir = project_on_plane(text_up_dir, normal); new_text_dir.normalize(); Geometry::rotation_from_two_vectors(old_text_dir, new_text_dir, rotation_axis, phi, &rotation_matrix); + + static double const PI = 3.141592653589793238; + if (abs(phi - PI) < EPSILON) + rotation_axis = normal; + mesh.rotate(phi, rotation_axis); const Selection & selection = m_parent.get_selection(); @@ -1439,10 +1445,11 @@ void GLGizmoText::generate_text_volume(bool is_temp) if (text.empty()) return; + std::wstring_convert> str_cnv; + std::wstring ws = boost::nowide::widen(m_text); std::vector alphas; - if (!get_utf8_sub_strings(m_text, strlen(m_text), alphas)) { - BOOST_LOG_TRIVIAL(info) << boost::format("Text: input text is not utf8"); - return; + for (auto w : ws) { + alphas.push_back(str_cnv.to_bytes(w)); } update_text_positions(alphas);