NEW: use noto sans JP font in language ja
JIRA: STUDIO-5770 remove unused font files Change-Id: Iaff91f4c8466371345591b883b6e79509d41c639 Signed-off-by: Stone Li <stone.li@bambulab.com> (cherry picked from commit 8e2ffdd609ece4374b28e52d401b1a31c96e4931)
This commit is contained in:
parent
3225124a7c
commit
26140050ec
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1342,6 +1342,9 @@ GUI_App::GUI_App()
|
||||||
{
|
{
|
||||||
//app config initializes early becasuse it is used in instance checking in BambuStudio.cpp
|
//app config initializes early becasuse it is used in instance checking in BambuStudio.cpp
|
||||||
this->init_app_config();
|
this->init_app_config();
|
||||||
|
if (app_config) {
|
||||||
|
::Label::initSysFont(app_config->get_language_code(), false);
|
||||||
|
}
|
||||||
this->init_download_path();
|
this->init_download_path();
|
||||||
|
|
||||||
reset_to_active();
|
reset_to_active();
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
#include "Label.hpp"
|
#include "Label.hpp"
|
||||||
#include "StaticBox.hpp"
|
#include "StaticBox.hpp"
|
||||||
|
|
||||||
|
#include "../GUI_App.hpp"
|
||||||
|
#include "libslic3r/AppConfig.hpp"
|
||||||
|
|
||||||
#include <wx/dcclient.h>
|
#include <wx/dcclient.h>
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
|
|
||||||
wxFont Label::sysFont(int size, bool bold)
|
wxFont Label::sysFont(int size, bool bold, std::string lang_code)
|
||||||
{
|
{
|
||||||
//#ifdef __linux__
|
//#ifdef __linux__
|
||||||
// return wxFont{};
|
// return wxFont{};
|
||||||
|
@ -14,7 +17,13 @@ wxFont Label::sysFont(int size, bool bold)
|
||||||
size = size * 4 / 5;
|
size = size * 4 / 5;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto face = wxString::FromUTF8("HarmonyOS Sans SC");
|
wxString face;
|
||||||
|
if (lang_code == "ja") {
|
||||||
|
face = wxString::FromUTF8("Noto Sans JP");
|
||||||
|
} else {
|
||||||
|
face = wxString::FromUTF8("HarmonyOS Sans SC");
|
||||||
|
}
|
||||||
|
|
||||||
wxFont font{size, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL, false, face};
|
wxFont font{size, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL, false, face};
|
||||||
font.SetFaceName(face);
|
font.SetFaceName(face);
|
||||||
if (!font.IsOk()) {
|
if (!font.IsOk()) {
|
||||||
|
@ -22,6 +31,7 @@ wxFont Label::sysFont(int size, bool bold)
|
||||||
if (bold) font.MakeBold();
|
if (bold) font.MakeBold();
|
||||||
font.SetPointSize(size);
|
font.SetPointSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
wxFont Label::Head_48;
|
wxFont Label::Head_48;
|
||||||
|
@ -47,9 +57,10 @@ wxFont Label::Body_10;
|
||||||
wxFont Label::Body_9;
|
wxFont Label::Body_9;
|
||||||
wxFont Label::Body_8;
|
wxFont Label::Body_8;
|
||||||
|
|
||||||
void Label::initSysFont()
|
void Label::initSysFont(std::string lang_code, bool load_font_resource)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
if (load_font_resource) {
|
||||||
const std::string& resource_path = Slic3r::resources_dir();
|
const std::string& resource_path = Slic3r::resources_dir();
|
||||||
wxString font_path = wxString::FromUTF8(resource_path+"/fonts/HarmonyOS_Sans_SC_Bold.ttf");
|
wxString font_path = wxString::FromUTF8(resource_path+"/fonts/HarmonyOS_Sans_SC_Bold.ttf");
|
||||||
bool result = wxFont::AddPrivateFont(font_path);
|
bool result = wxFont::AddPrivateFont(font_path);
|
||||||
|
@ -59,29 +70,30 @@ void Label::initSysFont()
|
||||||
result = wxFont::AddPrivateFont(font_path);
|
result = wxFont::AddPrivateFont(font_path);
|
||||||
//BOOST_LOG_TRIVIAL(info) << boost::format("add font of HarmonyOS_Sans_SC_Regular returns %1%")%result;
|
//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);
|
printf("add font of HarmonyOS_Sans_SC_Regular returns %d\n", result);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
Head_48 = Label::sysFont(48, true);
|
Head_48 = Label::sysFont(48, true, lang_code);
|
||||||
Head_32 = Label::sysFont(32, true);
|
Head_32 = Label::sysFont(32, true, lang_code);
|
||||||
Head_24 = Label::sysFont(24, true);
|
Head_24 = Label::sysFont(24, true, lang_code);
|
||||||
Head_20 = Label::sysFont(20, true);
|
Head_20 = Label::sysFont(20, true, lang_code);
|
||||||
Head_18 = Label::sysFont(18, true);
|
Head_18 = Label::sysFont(18, true, lang_code);
|
||||||
Head_16 = Label::sysFont(16, true);
|
Head_16 = Label::sysFont(16, true, lang_code);
|
||||||
Head_15 = Label::sysFont(15, true);
|
Head_15 = Label::sysFont(15, true, lang_code);
|
||||||
Head_14 = Label::sysFont(14, true);
|
Head_14 = Label::sysFont(14, true, lang_code);
|
||||||
Head_13 = Label::sysFont(13, true);
|
Head_13 = Label::sysFont(13, true, lang_code);
|
||||||
Head_12 = Label::sysFont(12, true);
|
Head_12 = Label::sysFont(12, true, lang_code);
|
||||||
Head_11 = Label::sysFont(11, true);
|
Head_11 = Label::sysFont(11, true, lang_code);
|
||||||
Head_10 = Label::sysFont(10, true);
|
Head_10 = Label::sysFont(10, true, lang_code);
|
||||||
|
|
||||||
Body_16 = Label::sysFont(16, false);
|
Body_16 = Label::sysFont(16, false, lang_code);
|
||||||
Body_15 = Label::sysFont(15, false);
|
Body_15 = Label::sysFont(15, false, lang_code);
|
||||||
Body_14 = Label::sysFont(14, false);
|
Body_14 = Label::sysFont(14, false, lang_code);
|
||||||
Body_13 = Label::sysFont(13, false);
|
Body_13 = Label::sysFont(13, false, lang_code);
|
||||||
Body_12 = Label::sysFont(12, false);
|
Body_12 = Label::sysFont(12, false, lang_code);
|
||||||
Body_11 = Label::sysFont(11, false);
|
Body_11 = Label::sysFont(11, false, lang_code);
|
||||||
Body_10 = Label::sysFont(10, false);
|
Body_10 = Label::sysFont(10, false, lang_code);
|
||||||
Body_9 = Label::sysFont(9, false);
|
Body_9 = Label::sysFont(9, false, lang_code);
|
||||||
Body_8 = Label::sysFont(8, false);
|
Body_8 = Label::sysFont(8, false, lang_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxTextWrapper2
|
class WXDLLIMPEXP_CORE wxTextWrapper2
|
||||||
|
|
|
@ -54,9 +54,9 @@ public:
|
||||||
static wxFont Body_9;
|
static wxFont Body_9;
|
||||||
static wxFont Body_8;
|
static wxFont Body_8;
|
||||||
|
|
||||||
static void initSysFont();
|
static void initSysFont(std::string lang_code = "", bool load_font_resource = true);
|
||||||
|
|
||||||
static wxFont sysFont(int size, bool bold = false);
|
static wxFont sysFont(int size, bool bold = false, std::string lang_code = "");
|
||||||
|
|
||||||
static wxSize split_lines(wxDC &dc, int width, const wxString &text, wxString &multiline_text);
|
static wxSize split_lines(wxDC &dc, int width, const wxString &text, wxString &multiline_text);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue