From 5ded68cab26dd274e2b90e70073898fea3fe2fd9 Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Tue, 31 Jan 2023 12:07:57 +0100 Subject: [PATCH] Allowe font which are not in allow list --- src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index b1eae3b74..2bb67dbb1 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -1109,7 +1109,6 @@ bool GLGizmoEmboss::set_volume(ModelVolume *volume) if (face_name_opt.has_value()) { face_name = wxString(face_name_opt->c_str()); - //* SWITCH for search in OS fonts // search in enumerated fonts // refresh list of installed font in the OS. init_face_names(); @@ -1118,12 +1117,19 @@ bool GLGizmoEmboss::set_volume(ModelVolume *volume) const std::vector &faces = m_face_names.faces; auto it = std::lower_bound(faces.begin(), faces.end(), face_name, cmp); is_font_installed = it != faces.end() && it->wx_name == face_name; - /*/ - // test it by Wx - wxFontEnumerator::InvalidateCache(); - wxFont wx_font_; // temporary structure - is_font_installed = wx_font_.SetFaceName(face_name); - // */ + + if (!is_font_installed) { + // check if wx allowed to set it up - another encoding of name + wxFontEnumerator::InvalidateCache(); + wxFont wx_font_; // temporary structure + if (wx_font_.SetFaceName(face_name) && + WxFontUtils::create_font_file(wx_font_) != nullptr // can load TTF file? + ) { + is_font_installed = true; + // QUESTION: add this name to allowed faces? + // Could create twin of font face + } + } } wxFont wx_font;