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

View File

@@ -92,6 +92,11 @@ target("device_controller")
target("remote_desk")
set_kind("binary")
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")
-- after_install(function (target)