Skip to content

Conversation

@lucasmerlin
Copy link
Contributor

@lucasmerlin lucasmerlin commented Sep 17, 2025

There were some breaking changes around font handling.
I also ran cargo update.

This should be merged after the update msrv PR.

Tests fail because of a failure to read the glyph_width 🤔.
This is where it fails:

fn width_body_space(ui: &Ui) -> f32 {
    let id = TextStyle::Body.resolve(ui.style());
    ui.fonts_mut(|f| f.glyph_width(&id, ' '))
}
thread 'main' panicked at /Users/lucas/.cargo/git/checkouts/egui-9c90d2f9798966b7/6ac155c/crates/epaint/src/text/font.rs:484:14:                                                                                                                                                      
Nonexistent font ID                                                                                                                                                                                                                                                                   
stack backtrace:                                                                                                                                                                                                                                                                      
   0: rust_begin_unwind                                                                                                                                                                                                                                                               
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:695:5                                                                                                                                                                                    
   1: core::panicking::panic_fmt                                                                                                                                                                                                                                                      
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/panicking.rs:75:14                                                                                                                                                                                   
   2: core::panicking::panic_display                                                                                                                                                                                                                                                  
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/panicking.rs:261:5                                                                                                                                                                                   
   3: core::option::expect_failed                                                                                                                                                                                                                                                     
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/option.rs:2024:5                                                                                                                                                                                     
   4: core::option::Option<T>::expect                                                                                                                                                                                                                                                 
             at /Users/lucas/.rustup/toolchains/1.86.0-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:933:21                                                                                                                                                    
   5: epaint::text::font::Font::glyph_width                                                                                                                                                                                                                                           
             at /Users/lucas/.cargo/git/checkouts/egui-9c90d2f9798966b7/6ac155c/crates/epaint/src/text/font.rs:481:21                                                                                                                                                                 
   6: epaint::text::fonts::FontsView::glyph_width                                                                                                                                                                                                                                     
             at /Users/lucas/.cargo/git/checkouts/egui-9c90d2f9798966b7/6ac155c/crates/epaint/src/text/fonts.rs:655:9                                                                                                                                                                 
   7: egui_commonmark_backend::elements::width_body_space::{{closure}}                                                                                                                                                                                                                
             at /Users/lucas/code/egui_commonmark/egui_commonmark_backend/src/elements.rs:86:22                                                                                                                                                                                       
   8: egui::context::Context::fonts_mut::{{closure}}                                                                                                                                                                                                                                  
             at /Users/lucas/.cargo/git/checkouts/egui-9c90d2f9798966b7/6ac155c/crates/egui/src/context.rs:1019:13                                                                                                                                                                    
   9: egui::context::Context::write                                                                                                                                                                                                                                                   
             at /Users/lucas/.cargo/git/checkouts/egui-9c90d2f9798966b7/6ac155c/crates/egui/src/context.rs:739:9                                                                                                                                                                      
  10: egui::context::Context::fonts_mut                                                                                                                                                                                                                                               
             at /Users/lucas/.cargo/git/checkouts/egui-9c90d2f9798966b7/6ac155c/crates/egui/src/context.rs:1017:9                                                                                                                                                                     
  11: egui::ui::Ui::fonts_mut                                                                                                                                                                                                                                                         
             at /Users/lucas/.cargo/git/checkouts/egui-9c90d2f9798966b7/6ac155c/crates/egui/src/ui.rs:858:9                                                                                                                                                                           
  12: egui_commonmark_backend::elements::width_body_space                                                                                                                                                                                                                             
             at /Users/lucas/code/egui_commonmark/egui_commonmark_backend/src/elements.rs:86:5                                                                                                                                                                                        
  13: egui_commonmark_backend::elements::bullet_point                                                                                                                                                                                                                                 
             at /Users/lucas/code/egui_commonmark/egui_commonmark_backend/src/elements.rs:24:20                                                                                                                                                                                       
  14: trybuild000::main::{{closure}}::{{closure}}                                                                                                                                                                                                                                     
             at /Users/lucas/code/egui_commonmark/egui_commonmark_macros/tests/pass/book.rs:8:9  

@lucasmerlin
Copy link
Contributor Author

The failing test was fixed via emilk/egui#7548

Cargo.toml Outdated
Comment on lines 31 to 34
[patch.crates-io]
# eframe = { git = "https://github.com/emilk/egui.git", branch = "main" }
# egui = { git = "https://github.com/emilk/egui.git", branch = "main" }
# egui_extras = { git = "https://github.com/emilk/egui.git", branch = "main" }
eframe = { git = "https://github.com/emilk/egui.git", branch = "main" }
egui = { git = "https://github.com/emilk/egui.git", branch = "main" }
egui_extras = { git = "https://github.com/emilk/egui.git", branch = "main" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

egui 0.33 is out now!

@lucasmerlin lucasmerlin changed the title Update egui to latest main Update egui to 0.33 Oct 9, 2025
@lampsitter lampsitter merged commit c9eceb6 into lampsitter:master Oct 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants