add dependency on FontConfig for linux

This commit is contained in:
Filip Sykala 2021-10-13 11:57:58 +02:00
parent 2b066813d1
commit 2ed08e68c3
2 changed files with 12 additions and 6 deletions

View File

@ -288,5 +288,5 @@ endif ()
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
find_package(GTK${SLIC3R_GTK} REQUIRED) find_package(GTK${SLIC3R_GTK} REQUIRED)
target_include_directories(libslic3r_gui PRIVATE ${GTK${SLIC3R_GTK}_INCLUDE_DIRS}) target_include_directories(libslic3r_gui PRIVATE ${GTK${SLIC3R_GTK}_INCLUDE_DIRS})
target_link_libraries(libslic3r_gui ${GTK${SLIC3R_GTK}_LIBRARIES}) target_link_libraries(libslic3r_gui ${GTK${SLIC3R_GTK}_LIBRARIES} fontconfig)
endif () endif ()

View File

@ -33,10 +33,16 @@
#define USE_FONT_DIALOG #define USE_FONT_DIALOG
#endif // apple #endif // apple
#ifdef __linux__ #ifdef __linux__
//#ifdef __WXGTK__
#define FontConfigExist
#endif
#ifdef FontConfigExist
#include <wx/filename.h> #include <wx/filename.h>
#include <fontconfig/fontconfig.h> #include <fontconfig/fontconfig.h>
#endif // __linux__ #define USE_FONT_DIALOG
#endif // FontConfigExist
#ifdef _WIN32 #ifdef _WIN32
#define USE_FONT_DIALOG #define USE_FONT_DIALOG
@ -76,7 +82,7 @@ public:
static ExPolygons to_ExPolygons(NSVGimage *image, float tessTol = 10., int max_level = 10); static ExPolygons to_ExPolygons(NSVGimage *image, float tessTol = 10., int max_level = 10);
}; };
#ifdef __linux__ #ifdef FontConfigExist
class FontConfigHelp class FontConfigHelp
{ {
public: public:
@ -169,7 +175,7 @@ public:
return std::string(fullFileName.c_str()); return std::string(fullFileName.c_str());
} }
}; };
#endif // __linux__ #endif // FontConfigExist
} // namespace Slic3r } // namespace Slic3r
@ -1079,7 +1085,7 @@ std::optional<Emboss::Font> WxFontUtils::load_font(const wxFont &font)
if (!font.IsOk()) return {}; if (!font.IsOk()) return {};
#ifdef _WIN32 #ifdef _WIN32
return Emboss::load_font(font.GetHFONT()); return Emboss::load_font(font.GetHFONT());
#elif __linux__ // if defined(__WXGTK__) #elif FontConfigExist
static FontConfigHelp help; static FontConfigHelp help;
std::string font_path = help.get_font_path(font); std::string font_path = help.get_font_path(font);
if (font_path.empty()) return {}; if (font_path.empty()) return {};