mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 04:16:04 +08:00
Add invalidation of wx font list when open combo box. Fix issue with new installed fonts
This commit is contained in:
parent
fce4f1f24e
commit
58c028d904
@ -848,7 +848,7 @@ std::unique_ptr<Emboss::FontFile> Emboss::create_font_file(HFONT hfont)
|
|||||||
HDC hdc = ::CreateCompatibleDC(NULL);
|
HDC hdc = ::CreateCompatibleDC(NULL);
|
||||||
if (hdc == NULL) {
|
if (hdc == NULL) {
|
||||||
assert(false);
|
assert(false);
|
||||||
// BOOST_LOG_TRIVIAL(error) << "Can't create HDC by CreateCompatibleDC(NULL)." << std::endl;
|
BOOST_LOG_TRIVIAL(error) << "Can't create HDC by CreateCompatibleDC(NULL).";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,7 +863,7 @@ std::unique_ptr<Emboss::FontFile> Emboss::create_font_file(HFONT hfont)
|
|||||||
::DeleteDC(hdc);
|
::DeleteDC(hdc);
|
||||||
if (size != loaded_size) {
|
if (size != loaded_size) {
|
||||||
assert(false);
|
assert(false);
|
||||||
// BOOST_LOG_TRIVIAL(error) << "Different loaded(from HFONT) data size." << std::endl;
|
BOOST_LOG_TRIVIAL(error) << "Different loaded(from HFONT) data size.";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return create_font_file(std::move(buffer));
|
return create_font_file(std::move(buffer));
|
||||||
|
@ -1338,6 +1338,9 @@ void GLGizmoEmboss::init_face_names() {
|
|||||||
if (m_face_names.is_init) return;
|
if (m_face_names.is_init) return;
|
||||||
m_face_names.is_init = true;
|
m_face_names.is_init = true;
|
||||||
|
|
||||||
|
// to reload fonts from system, when install new one
|
||||||
|
wxFontEnumerator::InvalidateCache();
|
||||||
|
|
||||||
auto create_truncated_names = [&facenames = m_face_names, &width = m_gui_cfg->face_name_max_width]() {
|
auto create_truncated_names = [&facenames = m_face_names, &width = m_gui_cfg->face_name_max_width]() {
|
||||||
for (FaceName &face : facenames.faces) {
|
for (FaceName &face : facenames.faces) {
|
||||||
std::string name_str(face.wx_name.ToUTF8().data());
|
std::string name_str(face.wx_name.ToUTF8().data());
|
||||||
@ -1374,9 +1377,9 @@ void GLGizmoEmboss::init_face_names() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << (m_face_names.hash == 0) ?
|
BOOST_LOG_TRIVIAL(info) << ((m_face_names.hash == 0) ?
|
||||||
"FontName list is generate from scratch." :
|
"FontName list is generate from scratch." :
|
||||||
"Hash are different. Only previous bad fonts are used and set again as bad";
|
"Hash are different. Only previous bad fonts are used and set again as bad");
|
||||||
m_face_names.hash = hash;
|
m_face_names.hash = hash;
|
||||||
|
|
||||||
// validation lambda
|
// validation lambda
|
||||||
|
Loading…
x
Reference in New Issue
Block a user