From 1afa3896692314de6e1b076bfd80f5f2d5e11eb5 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:49:45 +0900 Subject: [PATCH] Update context.rs --- crates/egui/src/context.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index d6669da60c9..d096e9b31e7 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -2418,15 +2418,12 @@ impl Context { self.write(|ctx| { let tessellation_options = ctx.memory.options.tessellation_options; - let texture_atlas = match ctx.fonts.get(&pixels_per_point.into()) { - Some(fonts) => fonts.texture_atlas(), - None => { - log::warn!("No font size matching {pixels_per_point} pixels per point found."); - ctx.fonts.iter().next() - .expect("tessellate called with a different pixels_per_point than the font atlas was created with. \ - You should use egui::FullOutput::pixels_per_point when tessellating.") - .1.texture_atlas() - } + let texture_atlas = if let Some(fonts) = ctx.fonts.get(&pixels_per_point.into()) { fonts.texture_atlas() } else { + log::warn!("No font size matching {pixels_per_point} pixels per point found."); + ctx.fonts.iter().next() + .expect("tessellate called with a different pixels_per_point than the font atlas was created with. \ + You should use egui::FullOutput::pixels_per_point when tessellating.") + .1.texture_atlas() }; let (font_tex_size, prepared_discs) = { let atlas = texture_atlas.lock();