1.Use PingFang.ttc as Chinese default fonts on MacOS;2.Fix link error for FFmpeg

This commit is contained in:
dijunkun
2024-05-28 15:25:16 +08:00
parent 905539a6eb
commit 759078ef7f
3 changed files with 24 additions and 13 deletions

View File

@@ -453,8 +453,14 @@ int main(int argc, char *argv[]) {
io.Fonts->GetGlyphRangesChineseFull()); io.Fonts->GetGlyphRangesChineseFull());
} }
#elif __APPLE__ #elif __APPLE__
io.Fonts->AddFontFromFileTTF("c:/windows/fonts/msyh.ttc", 13.0f, NULL, std::string default_font_path = "/System/Library/Fonts/PingFang.ttc";
io.Fonts->GetGlyphRangesChineseFull()); std::ifstream font_path_f(default_font_path.c_str());
std::string font_path =
font_path_f.good() ? "/System/Library/Fonts/PingFang.ttc" : "";
if (!font_path.empty()) {
io.Fonts->AddFontFromFileTTF(font_path.c_str(), 13.0f, NULL,
io.Fonts->GetGlyphRangesChineseFull());
}
#elif __linux__ #elif __linux__
io.Fonts->AddFontFromFileTTF("c:/windows/fonts/msyh.ttc", 13.0f, NULL, io.Fonts->AddFontFromFileTTF("c:/windows/fonts/msyh.ttc", 13.0f, NULL,
io.Fonts->GetGlyphRangesChineseFull()); io.Fonts->GetGlyphRangesChineseFull());
@@ -609,7 +615,7 @@ int main(int argc, char *argv[]) {
#endif #endif
#if CHINESE_FONT #if CHINESE_FONT
ImGui::Begin(u8"<EFBFBD>˵<EFBFBD>", nullptr, ImGui::Begin(u8"菜单", nullptr,
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse |
ImGuiWindowFlags_NoMove); ImGuiWindowFlags_NoMove);
#else #else
@@ -619,7 +625,7 @@ int main(int argc, char *argv[]) {
{ {
menu_hovered = ImGui::IsWindowHovered(); menu_hovered = ImGui::IsWindowHovered();
#if CHINESE_FONT #if CHINESE_FONT
ImGui::Text(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID:"); ImGui::Text(u8"本机ID:");
#else #else
ImGui::Text("LOCAL ID:"); ImGui::Text("LOCAL ID:");
#endif #endif
@@ -636,7 +642,7 @@ int main(int argc, char *argv[]) {
ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_ReadOnly); ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_ReadOnly);
#if CHINESE_FONT #if CHINESE_FONT
ImGui::Text(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"); ImGui::Text(u8"密码:");
#else #else
ImGui::Text("PASSWORD:"); ImGui::Text("PASSWORD:");
#endif #endif
@@ -647,7 +653,7 @@ int main(int argc, char *argv[]) {
ImGui::SetNextItemWidth(90); ImGui::SetNextItemWidth(90);
#if CHINESE_FONT #if CHINESE_FONT
ImGui::SetCursorPosX(60.0f); ImGui::SetCursorPosX(60.0f);
ImGui::InputTextWithHint("##server_pwd", u8"<EFBFBD>6<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>", ImGui::InputTextWithHint("##server_pwd", u8"最长6个字符",
input_password, IM_ARRAYSIZE(input_password), input_password, IM_ARRAYSIZE(input_password),
ImGuiInputTextFlags_CharsNoBlank); ImGuiInputTextFlags_CharsNoBlank);
#else #else
@@ -678,7 +684,7 @@ int main(int argc, char *argv[]) {
{ {
static char remote_id[20] = ""; static char remote_id[20] = "";
#if CHINESE_FONT #if CHINESE_FONT
ImGui::Text(u8"Զ<EFBFBD><EFBFBD>ID:"); ImGui::Text(u8"远端ID:");
#else #else
ImGui::Text("REMOTE ID:"); ImGui::Text("REMOTE ID:");
#endif #endif
@@ -697,7 +703,7 @@ int main(int argc, char *argv[]) {
ImGui::Spacing(); ImGui::Spacing();
#if CHINESE_FONT #if CHINESE_FONT
ImGui::Text(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"); ImGui::Text(u8"密码:");
#else #else
ImGui::Text("PASSWORD:"); ImGui::Text("PASSWORD:");
#endif #endif
@@ -706,7 +712,7 @@ int main(int argc, char *argv[]) {
static char client_password[20] = ""; static char client_password[20] = "";
#if CHINESE_FONT #if CHINESE_FONT
ImGui::SetCursorPosX(60.0f); ImGui::SetCursorPosX(60.0f);
ImGui::InputTextWithHint("##client_pwd", u8"<EFBFBD>6<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>", ImGui::InputTextWithHint("##client_pwd", u8"最长6个字符",
client_password, client_password,
IM_ARRAYSIZE(client_password), IM_ARRAYSIZE(client_password),
ImGuiInputTextFlags_CharsNoBlank); ImGuiInputTextFlags_CharsNoBlank);
@@ -722,7 +728,7 @@ int main(int argc, char *argv[]) {
ImGui::Separator(); ImGui::Separator();
ImGui::Spacing(); ImGui::Spacing();
#if CHINESE_FONT #if CHINESE_FONT
if (ImGui::Button(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")) { if (ImGui::Button(u8"连接")) {
#else #else
if (ImGui::Button("Connect")) { if (ImGui::Button("Connect")) {
#endif #endif
@@ -762,7 +768,7 @@ int main(int argc, char *argv[]) {
{ {
#if CHINESE_FONT #if CHINESE_FONT
if (ImGui::Button(u8"<EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD>")) { if (ImGui::Button(u8"重置窗口")) {
#else #else
if (ImGui::Button("Resize Window")) { if (ImGui::Button("Resize Window")) {
#endif #endif
@@ -779,7 +785,7 @@ int main(int argc, char *argv[]) {
ImGui::SameLine(); ImGui::SameLine();
#if CHINESE_FONT #if CHINESE_FONT
if (ImGui::Button(u8"ȫ<EFBFBD><EFBFBD>")) { if (ImGui::Button(u8"全屏")) {
#else #else
if (ImGui::Button("FULLSCREEN")) { if (ImGui::Button("FULLSCREEN")) {
#endif #endif

View File

@@ -92,6 +92,11 @@ target("device_controller")
target("remote_desk") target("remote_desk")
set_kind("binary") set_kind("binary")
add_deps("log", "common", "screen_capturer", "device_controller", "projectx") add_deps("log", "common", "screen_capturer", "device_controller", "projectx")
if is_os("macosx") then
add_packages("ffmpeg")
elseif is_os("linux") then
add_packages("ffmpeg")
end
add_files("src/gui/main.cpp") add_files("src/gui/main.cpp")
-- after_install(function (target) -- after_install(function (target)