Skip to content

Commit 35db281

Browse files
authored
bump version (#73)
1 parent 25d4241 commit 35db281

File tree

7 files changed

+30
-20
lines changed

7 files changed

+30
-20
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "kiorg"
3-
version = "1.2.3"
3+
version = "1.2.4"
44
edition = "2024"
55
authors = ["houqp"]
66
repository = "https://github.com/houqp/kiorg"

src/font.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn load_font_family(family_names: &[&str]) -> Option<Vec<u8>> {
3636
None
3737
}
3838

39-
pub fn load_system_fonts(mut fonts: FontDefinitions) -> FontDefinitions {
39+
fn load_system_fonts(mut fonts: FontDefinitions) -> FontDefinitions {
4040
debug!("Attempting to load system fonts");
4141
let mut fontdb = HashMap::new();
4242

@@ -115,3 +115,23 @@ pub fn load_system_fonts(mut fonts: FontDefinitions) -> FontDefinitions {
115115

116116
fonts
117117
}
118+
119+
/// Configure egui context with proper fonts for emoji and system font rendering
120+
/// This function should be used consistently across the application and tests
121+
pub fn configure_egui_fonts(ctx: &egui::Context) {
122+
let mut fonts = load_system_fonts(egui::FontDefinitions::default());
123+
124+
// Add Nerd Fonts to both Monospace and Proportional families
125+
fonts.font_data.insert(
126+
"nerdfonts".into(),
127+
egui_nerdfonts::Variant::Regular.font_data().into(),
128+
);
129+
if let Some(font_keys) = fonts.families.get_mut(&egui::FontFamily::Monospace) {
130+
font_keys.push("nerdfonts".into());
131+
}
132+
if let Some(font_keys) = fonts.families.get_mut(&egui::FontFamily::Proportional) {
133+
font_keys.push("nerdfonts".into());
134+
}
135+
136+
ctx.set_fonts(fonts);
137+
}

src/main.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,8 @@ fn main() -> Result<(), eframe::Error> {
8686
Box::new(|cc| {
8787
egui_extras::install_image_loaders(&cc.egui_ctx);
8888

89-
let mut fonts = kiorg::font::load_system_fonts(egui::FontDefinitions::default());
90-
91-
// Add Nerd Fonts to both Monospace and Proportional families
92-
fonts.font_data.insert(
93-
"nerdfonts".into(),
94-
egui_nerdfonts::Variant::Regular.font_data().into(),
95-
);
96-
if let Some(font_keys) = fonts.families.get_mut(&egui::FontFamily::Monospace) {
97-
font_keys.push("nerdfonts".into());
98-
}
99-
if let Some(font_keys) = fonts.families.get_mut(&egui::FontFamily::Proportional) {
100-
font_keys.push("nerdfonts".into());
101-
}
102-
103-
cc.egui_ctx.set_fonts(fonts);
89+
// Configure fonts for proper emoji and system font rendering
90+
kiorg::font::configure_egui_fonts(&cc.egui_ctx);
10491

10592
match Kiorg::new(cc, initial_dir) {
10693
Ok(app) => Ok(Box::new(app)),

tests/mod/ui_test_helpers.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,11 @@ impl TestHarnessBuilder {
357357
let mut harness = Harness::builder()
358358
.with_size(self.window_size)
359359
.with_max_steps(20)
360-
.build_eframe(|_cc| app);
361-
// Run one step to initialize the app
360+
.build_eframe(|cc| {
361+
// Ensure fonts are configured in the actual test context
362+
kiorg::font::configure_egui_fonts(&cc.egui_ctx);
363+
app
364+
});
362365
harness.step();
363366

364367
let mut harness = TestHarness {

tests/snapshots/help_menu.png

20.1 KB
Loading
10.2 KB
Loading

0 commit comments

Comments
 (0)