mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
ENH: use wxFont::AddPrivateFont to load fonts for linux
Change-Id: Iefe1753a08fd188a274b4d555c5fcda8fca6d719
This commit is contained in:
parent
8f330d8b82
commit
27d2008037
3 changed files with 19 additions and 2 deletions
4
deps/wxWidgets/wxWidgets.cmake
vendored
4
deps/wxWidgets/wxWidgets.cmake
vendored
|
@ -7,6 +7,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set(_gtk_ver 3)
|
set(_gtk_ver 3)
|
||||||
endif ()
|
endif ()
|
||||||
set(_wx_toolkit "-DwxBUILD_TOOLKIT=gtk${_gtk_ver}")
|
set(_wx_toolkit "-DwxBUILD_TOOLKIT=gtk${_gtk_ver}")
|
||||||
|
set(_wx_private_font "-DwxUSE_PRIVATE_FONTS=1")
|
||||||
|
else ()
|
||||||
|
set(_wx_private_font "-DwxUSE_PRIVATE_FONTS=0")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
@ -30,6 +33,7 @@ bambustudio_add_cmake_project(wxWidgets
|
||||||
-DwxUSE_MEDIACTRL=ON
|
-DwxUSE_MEDIACTRL=ON
|
||||||
-DwxUSE_DETECT_SM=OFF
|
-DwxUSE_DETECT_SM=OFF
|
||||||
-DwxUSE_UNICODE=ON
|
-DwxUSE_UNICODE=ON
|
||||||
|
${_wx_private_font}
|
||||||
-DwxUSE_OPENGL=ON
|
-DwxUSE_OPENGL=ON
|
||||||
-DwxUSE_WEBVIEW=ON
|
-DwxUSE_WEBVIEW=ON
|
||||||
${_wx_edge}
|
${_wx_edge}
|
||||||
|
|
|
@ -134,7 +134,7 @@ elseif (MSVC)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||||
else ()
|
else ()
|
||||||
# Boost on Raspberry-Pi does not link to pthreads explicitely.
|
# Boost on Raspberry-Pi does not link to pthreads explicitely.
|
||||||
target_link_libraries(BambuStudio ${CMAKE_DL_LIBS} -lstdc++ Threads::Threads)
|
target_link_libraries(BambuStudio ${CMAKE_DL_LIBS} -lstdc++ Threads::Threads pangoft2-1.0)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Add the Slic3r GUI library, libcurl, OpenGL and GLU libraries.
|
# Add the Slic3r GUI library, libcurl, OpenGL and GLU libraries.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "Label.hpp"
|
#include "Label.hpp"
|
||||||
#include "StaticBox.hpp"
|
#include "StaticBox.hpp"
|
||||||
|
|
||||||
|
@ -41,6 +42,18 @@ wxFont Label::Body_9;
|
||||||
|
|
||||||
void Label::initSysFont()
|
void Label::initSysFont()
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
|
const std::string& resource_path = Slic3r::resources_dir();
|
||||||
|
wxString font_path = wxString::FromUTF8(resource_path+"/fonts/HarmonyOS_Sans_SC_Bold.ttf");
|
||||||
|
bool result = wxFont::AddPrivateFont(font_path);
|
||||||
|
//BOOST_LOG_TRIVIAL(info) << boost::format("add font of HarmonyOS_Sans_SC_Bold returns %1%")%result;
|
||||||
|
printf("add font of HarmonyOS_Sans_SC_Bold returns %d\n", result);
|
||||||
|
font_path = wxString::FromUTF8(resource_path+"/fonts/HarmonyOS_Sans_SC_Regular.ttf");
|
||||||
|
result = wxFont::AddPrivateFont(font_path);
|
||||||
|
//BOOST_LOG_TRIVIAL(info) << boost::format("add font of HarmonyOS_Sans_SC_Regular returns %1%")%result;
|
||||||
|
printf("add font of HarmonyOS_Sans_SC_Regular returns %d\n", result);
|
||||||
|
#endif
|
||||||
|
|
||||||
Head_24 = Label::sysFont(24, true);
|
Head_24 = Label::sysFont(24, true);
|
||||||
Head_20 = Label::sysFont(20, true);
|
Head_20 = Label::sysFont(20, true);
|
||||||
Head_18 = Label::sysFont(18, true);
|
Head_18 = Label::sysFont(18, true);
|
||||||
|
@ -215,7 +228,7 @@ Label::Label(wxWindow *parent, wxFont const &font, wxString const &text, long st
|
||||||
SetBackgroundColour(StaticBox::GetParentBackgroundColor(parent));
|
SetBackgroundColour(StaticBox::GetParentBackgroundColor(parent));
|
||||||
if (style & LB_PROPAGATE_MOUSE_EVENT) {
|
if (style & LB_PROPAGATE_MOUSE_EVENT) {
|
||||||
for (auto evt : {
|
for (auto evt : {
|
||||||
wxEVT_LEFT_UP, wxEVT_LEFT_DOWN})
|
wxEVT_LEFT_UP, wxEVT_LEFT_DOWN})
|
||||||
Bind(evt, [this] (auto & e) { GetParent()->GetEventHandler()->ProcessEventLocally(e); });
|
Bind(evt, [this] (auto & e) { GetParent()->GetEventHandler()->ProcessEventLocally(e); });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue