Use fontDialog only when know how to get font on Operating System

This commit is contained in:
Filip Sykala 2021-10-04 14:47:44 +02:00
parent bc170fa217
commit 0ce004c285
2 changed files with 25 additions and 10 deletions
src/libslic3r

View file

@ -406,6 +406,12 @@ std::optional<Emboss::Font> Emboss::load_font(HFONT hfont)
::SelectObject(hdc, hfont);
size_t size = ::GetFontData(hdc, dwTable, dwOffset, NULL, 0);
if (size == GDI_ERROR) {
// HFONT is NOT TTC(collection)
dwTable = 0;
size = ::GetFontData(hdc, dwTable, dwOffset, NULL, 0);
}
if (size == 0 || size == GDI_ERROR) {
std::cerr << "HFONT doesn't have size.";
::DeleteDC(hdc);