Skip to content

Commit 21790a2

Browse files
committed
Fix font rendering, layout, and Windows tray restore
- Put CJK font at END of family list (push instead of insert(0)) so egui's built-in Latin fonts render ASCII/Latin text first, with CJK font as fallback only for Chinese characters - Increase launcher window height from 260 to 290 to prevent bottom navigation buttons from being cut off - Use ViewportCommand::Minimized instead of hide_app_window on Windows so the eframe event loop keeps running and tray click events are properly delivered for restore/quit
1 parent af0c472 commit 21790a2

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

src/gui.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const ACTIVE_REPAINT_INTERVAL: Duration = Duration::from_millis(100);
3838
const IDLE_REPAINT_INTERVAL: Duration = Duration::from_secs(5);
3939
const TRAY_REPAINT_INTERVAL: Duration = Duration::from_secs(15);
4040
const EMBEDDED_CJK_FONT: &[u8] = include_bytes!("../assets/fonts/DroidSansFallbackFull.ttf");
41-
const LAUNCHER_WINDOW_SIZE: [f32; 2] = [720.0, 260.0];
41+
const LAUNCHER_WINDOW_SIZE: [f32; 2] = [720.0, 290.0];
4242
const DETAILS_WINDOW_SIZE: [f32; 2] = [760.0, 520.0];
4343
const TITLE_BAR_HEIGHT: f32 = 52.0;
4444

@@ -1298,11 +1298,7 @@ impl AcceleratorApp {
12981298
let _ = tray.tray_icon.set_visible(true);
12991299
self.hidden_to_tray = true;
13001300
self.last_minimized = true;
1301-
if let Some(hwnd) = self.window_handle {
1302-
let _ = crate::platform::hide_app_window(hwnd);
1303-
} else {
1304-
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(true));
1305-
}
1301+
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(true));
13061302
ctx.request_repaint();
13071303
} else {
13081304
self.feedback = "托盘不可用,已退回系统最小化".to_string();
@@ -1389,12 +1385,8 @@ impl AcceleratorApp {
13891385
if let Some(tray) = &self.tray {
13901386
let _ = tray.tray_icon.set_visible(false);
13911387
}
1392-
if let Some(hwnd) = self.window_handle {
1393-
let _ = crate::platform::restore_app_window(hwnd);
1394-
} else {
1395-
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(false));
1396-
ctx.send_viewport_cmd(egui::ViewportCommand::Focus);
1397-
}
1388+
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(false));
1389+
ctx.send_viewport_cmd(egui::ViewportCommand::Focus);
13981390
ctx.request_repaint();
13991391
}
14001392

@@ -1768,10 +1760,10 @@ fn install_fonts(ctx: &egui::Context) {
17681760
let (font_name, font_data) = load_ui_font();
17691761
fonts.font_data.insert(font_name.clone(), font_data.into());
17701762
if let Some(family) = fonts.families.get_mut(&FontFamily::Proportional) {
1771-
family.insert(0, font_name.clone());
1763+
family.push(font_name.clone());
17721764
}
17731765
if let Some(family) = fonts.families.get_mut(&FontFamily::Monospace) {
1774-
family.insert(0, font_name);
1766+
family.push(font_name);
17751767
}
17761768
ctx.set_fonts(fonts);
17771769
}

0 commit comments

Comments
 (0)