Use fontDialog only when know how to get font on Operating System
This commit is contained in:
parent
bc170fa217
commit
0ce004c285
2 changed files with 25 additions and 10 deletions
src/libslic3r
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue