diff --git a/src/renderer/caching_shaper.rs b/src/renderer/caching_shaper.rs index 7fa53a9..365f849 100644 --- a/src/renderer/caching_shaper.rs +++ b/src/renderer/caching_shaper.rs @@ -39,8 +39,8 @@ fn build_collection_by_font_name(font_name: Option<&str>) -> FontCollection { let mut collection = FontCollection::new(); if let Some(font_name) = font_name { - if let Ok(custom) = source.select_family_by_name(font_name) { - let font = custom.fonts()[0].load().unwrap(); + if let Ok(custom) = source.select_best_match(&[FamilyName::Title(font_name.to_string())], &Properties::new()) { + let font = custom.load().unwrap(); collection.add_family(FontFamily::new_from_font(font)); } } diff --git a/src/window.rs b/src/window.rs index ec18558..c161a21 100644 --- a/src/window.rs +++ b/src/window.rs @@ -171,14 +171,12 @@ pub fn ui_loop() { let frame_start = Instant::now(); if REDRAW_SCHEDULER.should_draw() { - if let Err(err) = panic::catch_unwind(|| { - skulpin_renderer.draw(&window, |canvas, coordinate_system_helper| { - if renderer.draw(canvas, coordinate_system_helper) { - handle_new_grid_size(window.inner_size(), &renderer) - } - }).ok(); + if let Err(e) = skulpin_renderer.draw(&window, |canvas, coordinate_system_helper| { + if renderer.draw(canvas, coordinate_system_helper) { + handle_new_grid_size(window.inner_size(), &renderer) + } }) { - println!("Render failed. Closing app"); + println!("Render failed. Closing"); *control_flow = ControlFlow::Exit; return; }