更新ui中
This commit is contained in:
47
src/theme.rs
47
src/theme.rs
@@ -83,53 +83,6 @@ pub fn apply_theme(ctx: &egui::Context, theme: &AppTheme) {
|
||||
ctx.set_global_style(style);
|
||||
}
|
||||
|
||||
pub fn apply_fonts(ctx: &egui::Context) {
|
||||
let mut fonts = egui::FontDefinitions::default();
|
||||
|
||||
fonts.font_data.insert(
|
||||
"Hack-Bold".to_owned(),
|
||||
egui::FontData::from_static(include_bytes!("../static/Hack-Bold.ttf")).into(),
|
||||
);
|
||||
|
||||
let has_yahei = std::fs::read(r"C:\Windows\Fonts\msyh.ttc")
|
||||
.or_else(|_| std::fs::read(r"C:\Windows\Fonts\msyhbd.ttc"))
|
||||
.map(|font_data| {
|
||||
fonts.font_data.insert(
|
||||
"Microsoft-YaHei".to_owned(),
|
||||
egui::FontData::from_owned(font_data).into(),
|
||||
);
|
||||
})
|
||||
.is_ok();
|
||||
|
||||
fonts
|
||||
.families
|
||||
.entry(egui::FontFamily::Proportional)
|
||||
.or_default()
|
||||
.insert(0, "Hack-Bold".to_owned());
|
||||
if has_yahei {
|
||||
fonts
|
||||
.families
|
||||
.entry(egui::FontFamily::Proportional)
|
||||
.or_default()
|
||||
.push("Microsoft-YaHei".to_owned());
|
||||
}
|
||||
|
||||
fonts
|
||||
.families
|
||||
.entry(egui::FontFamily::Monospace)
|
||||
.or_default()
|
||||
.insert(0, "Hack-Bold".to_owned());
|
||||
if has_yahei {
|
||||
fonts
|
||||
.families
|
||||
.entry(egui::FontFamily::Monospace)
|
||||
.or_default()
|
||||
.push("Microsoft-YaHei".to_owned());
|
||||
}
|
||||
|
||||
ctx.set_fonts(fonts);
|
||||
}
|
||||
|
||||
pub fn panel_frame(ctx: &egui::Context) -> egui::Frame {
|
||||
let style = ctx.global_style();
|
||||
egui::Frame::window(&style)
|
||||
|
||||
Reference in New Issue
Block a user